com.pastdev.httpcomponents.factory.TunnelValueFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of server Show documentation
Show all versions of server Show documentation
A set of interfaces and factories for building servers.
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);
}
}