All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pastdev.httpcomponents.factory.TunnelValueFactory Maven / Gradle / Ivy

The newest version!
package com.pastdev.httpcomponents.factory;


import java.util.Map;


import com.pastdev.httpcomponents.annotations.Environment;
import com.pastdev.httpcomponents.server.Servers;


public class TunnelValueFactory implements EnvironmentValueFactory {
    private Map params;

    public TunnelValueFactory( Map params ) {
        this.params = params;
    }

    @Override
    @SuppressWarnings( "unchecked" )
    public  T valueOf( Servers servers, Environment environment ) {
        String hostName = servers.getHostName( environment.serverRef() );
        int port = servers.getPort( environment.serverRef() );
        String path = params == null ? null : params.get( "path" );
        if ( path == null ) {
            path = "localhost";
        }

        return (T) (path + "|" + hostName + ":" + port);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy