Package net.officefloor.server.http.impl
Class HttpServerLocationImpl
- java.lang.Object
-
- net.officefloor.server.http.impl.HttpServerLocationImpl
-
- All Implemented Interfaces:
HttpServerLocation
public class HttpServerLocationImpl extends java.lang.Object implements HttpServerLocation
HttpServerLocationimplementation.- Author:
- Daniel Sagenschneider
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_HTTP_PORTDefault HTTP port.static intDEFAULT_HTTPS_PORTDefault 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
Constructors Constructor Description HttpServerLocationImpl()Instantiate with defaults for testing.HttpServerLocationImpl(java.lang.String domain, int httpPort, int httpsPort)Instantiate for running single instance.HttpServerLocationImpl(java.lang.String domain, int httpPort, int httpsPort, java.lang.String clusterHostName)Instantiate for running in a cluster with same port mappings.HttpServerLocationImpl(java.lang.String domain, int httpPort, int httpsPort, java.lang.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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringcreateClientUrl(boolean isSecure, java.lang.String path)Creates the client URL to call theHttpServer.java.lang.StringgetClusterHostName()Obtains the name of the host for the server within the cluster.intgetClusterHttpPort()The cluster may be behind a load balancer and the server may be running on a different port than expected by the client.intgetClusterHttpsPort()The cluster may be behind a load balancer and the server may be running on a different port than expected by the client.static java.lang.StringgetDefaultHostName()Obtains the default host name.java.lang.StringgetDomain()Obtains the domain for the server.intgetHttpPort()Obtains the HTTP port.intgetHttpsPort()Obtains the HTTPS port.
-
-
-
Field Detail
-
DEFAULT_HTTP_PORT
public static final int DEFAULT_HTTP_PORT
Default HTTP port.- See Also:
- Constant Field Values
-
DEFAULT_HTTPS_PORT
public static final int DEFAULT_HTTPS_PORT
Default HTTPS port.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HttpServerLocationImpl
public HttpServerLocationImpl()
Instantiate with defaults for testing.
-
HttpServerLocationImpl
public HttpServerLocationImpl(SourceContext context)
Instantiate fromPropertyvalues configured firstly fromSourceContext, thenSystem(then defaults).- Parameters:
context-SourceContext.
-
HttpServerLocationImpl
public HttpServerLocationImpl(java.lang.String domain, int httpPort, int httpsPort)Instantiate for running single instance.- Parameters:
domain- Domain.httpPort- HTTP port.httpsPort- HTTPS port.
-
HttpServerLocationImpl
public HttpServerLocationImpl(java.lang.String domain, int httpPort, int httpsPort, java.lang.String clusterHostName)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(java.lang.String domain, int httpPort, int httpsPort, java.lang.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 Detail
-
getDefaultHostName
public static java.lang.String getDefaultHostName()
Obtains the default host name.- Returns:
- Default Host name.
-
getDomain
public java.lang.String 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
public java.lang.String 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
public java.lang.String createClientUrl(boolean isSecure, java.lang.String path)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.
-
-