public class HttpApplicationLocationMangedObject extends Object implements CoordinatingManagedObject<HttpApplicationLocationManagedObjectSource.Dependencies>, HttpApplicationLocation
Constructor and Description |
---|
HttpApplicationLocationMangedObject(String domain,
int httpPort,
int httpsPort,
String contextPath,
String clusterHostName,
int clusterHttpPort,
int clusterHttpsPort)
Initiate.
|
Modifier and Type | Method and Description |
---|---|
String |
getClusterHostName()
Obtains the name of the host for the application within the cluster.
|
int |
getClusterHttpPort()
The cluster may be behind a load balancer and the application may be
running on a different port than expected by the client.
|
int |
getClusterHttpsPort()
The cluster may be behind a load balancer and the application may be
running on a different port than expected by the client.
|
String |
getContextPath()
Obtains the URI prefix to the application.
|
String |
getDomain()
Obtains the domain for the application.
|
int |
getHttpPort()
Obtains the HTTP port.
|
int |
getHttpsPort()
Obtains the HTTPS port.
|
Object |
getObject()
Obtains the object being managed.
|
void |
loadObjects(ObjectRegistry<HttpApplicationLocationManagedObjectSource.Dependencies> registry)
Loads the Objects of the
ManagedObject instances to be referenced
by this CoordinatingManagedObject . |
String |
transformToApplicationCanonicalPath(String requestUri)
Transforms the
HttpRequest request URI to a canonical path
relative to the application root. |
static String |
transformToCanonicalPath(String path)
Transforms the input Request URI path to a canonical path.
|
String |
transformToClientPath(String applicationPath,
boolean isSecure)
Transforms the application path to a client path.
|
public HttpApplicationLocationMangedObject(String domain, int httpPort, int httpsPort, String contextPath, String clusterHostName, int clusterHttpPort, int clusterHttpsPort)
domain
- Domain.httpPort
- HTTP port.httpsPort
- HTTPS port.contextPath
- Context path.clusterHostName
- Cluster host name.clusterHttpPort
- Cluster HTTP port.clusterHttpsPort
- Cluster HTTPS port.public static String transformToCanonicalPath(String path) throws InvalidHttpRequestUriException
path
- Path to transform.InvalidHttpRequestUriException
- Should the Request URI path be invalid.public void loadObjects(ObjectRegistry<HttpApplicationLocationManagedObjectSource.Dependencies> registry) throws Throwable
CoordinatingManagedObject
Loads the Objects of the ManagedObject
instances to be referenced
by this CoordinatingManagedObject
.
References to the loaded Objects must be released on recycling the
ManagedObject
.
loadObjects
in interface CoordinatingManagedObject<HttpApplicationLocationManagedObjectSource.Dependencies>
registry
- Registry of the Objects for the ManagedObject
instances.Throwable
- Should this CoordinatingManagedObject
fail to load
the ManagedObject
.public Object getObject() throws Throwable
ManagedObject
getObject
in interface ManagedObject
Throwable
- Indicating failed to obtain the object for use.public String getDomain()
HttpApplicationLocation
Obtains the domain for the application.
This is as the client will see the application.
getDomain
in interface HttpApplicationLocation
public int getHttpPort()
HttpApplicationLocation
Obtains the HTTP port.
This is as the client will see the application.
getHttpPort
in interface HttpApplicationLocation
public int getHttpsPort()
HttpApplicationLocation
Obtains the HTTPS port.
This is as the client will see the application.
getHttpsPort
in interface HttpApplicationLocation
public String getContextPath()
HttpApplicationLocation
getContextPath
in interface HttpApplicationLocation
null
if no
context path for the application.public String getClusterHostName()
HttpApplicationLocation
getClusterHostName
in interface HttpApplicationLocation
public int getClusterHttpPort()
HttpApplicationLocation
getClusterHttpPort
in interface HttpApplicationLocation
public int getClusterHttpsPort()
HttpApplicationLocation
getClusterHttpsPort
in interface HttpApplicationLocation
public String transformToApplicationCanonicalPath(String requestUri) throws InvalidHttpRequestUriException, IncorrectHttpRequestContextPathException
HttpApplicationLocation
HttpRequest
request URI to a canonical path
relative to the application root. This will strip off the domain, port
and context path.transformToApplicationCanonicalPath
in interface HttpApplicationLocation
requestUri
- Request URI from the HttpRequest
.InvalidHttpRequestUriException
- Should the HttpRequest
request URI be invalid.IncorrectHttpRequestContextPathException
- Should the HttpRequest
request URI have the incorrect
context path for the application.public String transformToClientPath(String applicationPath, boolean isSecure)
HttpApplicationLocation
transformToClientPath
in interface HttpApplicationLocation
applicationPath
- Path relative to the application root.isSecure
- Indicates if the resulting client path is to be secure. In
other words to use the HTTPS protocol.Copyright © 2005–2016. All rights reserved.