Package net.officefloor.server.http.impl
Class HttpServerLocationImpl
java.lang.Object
net.officefloor.server.http.impl.HttpServerLocationImpl
- All Implemented Interfaces:
HttpServerLocation
HttpServerLocation implementation.- Author:
- Daniel Sagenschneider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault HTTP port.static final intDefault HTTPS port.Fields inherited from interface net.officefloor.server.http.HttpServerLocation
PROPERTY_CLUSTER_HOST_NAME, PROPERTY_CLUSTER_HTTP_PORT, PROPERTY_CLUSTER_HTTPS_PORT, PROPERTY_DOMAIN, PROPERTY_HTTP_PORT, PROPERTY_HTTPS_PORT -
Constructor Summary
ConstructorsConstructorDescriptionInstantiate with defaults for testing.HttpServerLocationImpl(String domain, int httpPort, int httpsPort) Instantiate for running single instance.HttpServerLocationImpl(String domain, int httpPort, int httpsPort, String clusterHostName) Instantiate for running in a cluster with same port mappings.HttpServerLocationImpl(String domain, int httpPort, int httpsPort, String clusterHostName, int clusterHttpPort, int clusterHttpsPort) Instantiate for running in a cluster.HttpServerLocationImpl(SourceContext context) Instantiate fromPropertyvalues configured firstly fromSourceContext, thenSystem(then defaults). -
Method Summary
Modifier and TypeMethodDescriptioncreateClientUrl(boolean isSecure, String path) Creates the client URL to call theHttpServer.Obtains the name of the host for the server within the cluster.intThe cluster may be behind a load balancer and the server may be running on a different port than expected by the client.intThe cluster may be behind a load balancer and the server may be running on a different port than expected by the client.static StringObtains the default host name.Obtains the domain for the server.intObtains the HTTP port.intObtains the HTTPS port.
-
Field Details
-
DEFAULT_HTTP_PORT
public static final int DEFAULT_HTTP_PORTDefault HTTP port.- See Also:
-
DEFAULT_HTTPS_PORT
public static final int DEFAULT_HTTPS_PORTDefault HTTPS port.- See Also:
-
-
Constructor Details
-
HttpServerLocationImpl
public HttpServerLocationImpl()Instantiate with defaults for testing. -
HttpServerLocationImpl
Instantiate fromPropertyvalues configured firstly fromSourceContext, thenSystem(then defaults).- Parameters:
context-SourceContext.
-
HttpServerLocationImpl
Instantiate for running single instance.- Parameters:
domain- Domain.httpPort- HTTP port.httpsPort- HTTPS port.
-
HttpServerLocationImpl
Instantiate for running in a cluster with same port mappings.- Parameters:
domain- Domain.httpPort- HTTP port.httpsPort- HTTPS port.clusterHostName- Cluster host name.
-
HttpServerLocationImpl
public HttpServerLocationImpl(String domain, int httpPort, int httpsPort, String clusterHostName, int clusterHttpPort, int clusterHttpsPort) Instantiate for running in a cluster.- Parameters:
domain- Domain.httpPort- HTTP port.httpsPort- HTTPS port.clusterHostName- Cluster host name.clusterHttpPort- Cluster HTTP port.clusterHttpsPort- Cluster HTTPS port.
-
-
Method Details
-
getDefaultHostName
Obtains the default host name.- Returns:
- Default Host name.
-
getDomain
Description copied from interface:HttpServerLocationObtains the domain for the server.
This is as the client will see the server.
- Specified by:
getDomainin interfaceHttpServerLocation- Returns:
- Domain for the server.
-
getHttpPort
public int getHttpPort()Description copied from interface:HttpServerLocationObtains the HTTP port.
This is as the client will see the server.
- Specified by:
getHttpPortin interfaceHttpServerLocation- Returns:
- HTTP port.
-
getHttpsPort
public int getHttpsPort()Description copied from interface:HttpServerLocationObtains the HTTPS port.
This is as the client will see the server.
- Specified by:
getHttpsPortin interfaceHttpServerLocation- Returns:
- HTTPS port.
-
getClusterHostName
Description copied from interface:HttpServerLocationObtains the name of the host for the server within the cluster. This name should be understood by all nodes within the cluster.- Specified by:
getClusterHostNamein interfaceHttpServerLocation- Returns:
- Name of the host within the cluster.
-
getClusterHttpPort
public int getClusterHttpPort()Description copied from interface:HttpServerLocationThe cluster may be behind a load balancer and the server may be running on a different port than expected by the client.- Specified by:
getClusterHttpPortin interfaceHttpServerLocation- Returns:
- Actual port on the cluster host the server is running on.
-
getClusterHttpsPort
public int getClusterHttpsPort()Description copied from interface:HttpServerLocationThe cluster may be behind a load balancer and the server may be running on a different port than expected by the client.- Specified by:
getClusterHttpsPortin interfaceHttpServerLocation- Returns:
- Actual secure port on the cluster host the server is running on.
-
createClientUrl
Description copied from interface:HttpServerLocationCreates the client URL to call theHttpServer.- Specified by:
createClientUrlin interfaceHttpServerLocation- Parameters:
isSecure- If secure URL.path- Path including query string and fragment.- Returns:
- URL for the client to call on the
HttpServer.
-