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
HttpServerLocation
implementation.- Author:
- Daniel Sagenschneider
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_HTTP_PORT
Default HTTP port.static int
DEFAULT_HTTPS_PORT
Default 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 fromProperty
values configured firstly fromSourceContext
, thenSystem
(then defaults).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
createClientUrl(boolean isSecure, java.lang.String path)
Creates the client URL to call theHttpServer
.java.lang.String
getClusterHostName()
Obtains the name of the host for the server within the cluster.int
getClusterHttpPort()
The cluster may be behind a load balancer and the server may be running on a different port than expected by the client.int
getClusterHttpsPort()
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.String
getDefaultHostName()
Obtains the default host name.java.lang.String
getDomain()
Obtains the domain for the server.int
getHttpPort()
Obtains the HTTP port.int
getHttpsPort()
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 fromProperty
values 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:HttpServerLocation
Obtains the domain for the server.
This is as the client will see the server.
- Specified by:
getDomain
in interfaceHttpServerLocation
- Returns:
- Domain for the server.
-
getHttpPort
public int getHttpPort()
Description copied from interface:HttpServerLocation
Obtains the HTTP port.
This is as the client will see the server.
- Specified by:
getHttpPort
in interfaceHttpServerLocation
- Returns:
- HTTP port.
-
getHttpsPort
public int getHttpsPort()
Description copied from interface:HttpServerLocation
Obtains the HTTPS port.
This is as the client will see the server.
- Specified by:
getHttpsPort
in interfaceHttpServerLocation
- Returns:
- HTTPS port.
-
getClusterHostName
public java.lang.String getClusterHostName()
Description copied from interface:HttpServerLocation
Obtains the name of the host for the server within the cluster. This name should be understood by all nodes within the cluster.- Specified by:
getClusterHostName
in interfaceHttpServerLocation
- Returns:
- Name of the host within the cluster.
-
getClusterHttpPort
public int getClusterHttpPort()
Description copied from interface:HttpServerLocation
The cluster may be behind a load balancer and the server may be running on a different port than expected by the client.- Specified by:
getClusterHttpPort
in interfaceHttpServerLocation
- Returns:
- Actual port on the cluster host the server is running on.
-
getClusterHttpsPort
public int getClusterHttpsPort()
Description copied from interface:HttpServerLocation
The cluster may be behind a load balancer and the server may be running on a different port than expected by the client.- Specified by:
getClusterHttpsPort
in 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:HttpServerLocation
Creates the client URL to call theHttpServer
.- Specified by:
createClientUrl
in interfaceHttpServerLocation
- Parameters:
isSecure
- If secure URL.path
- Path including query string and fragment.- Returns:
- URL for the client to call on the
HttpServer
.
-
-