org.globus.wsrf.container
Class ServiceHost

java.lang.Object
  extended byorg.globus.wsrf.container.ServiceHost

public class ServiceHost
extends java.lang.Object

Host lookup used to support multi-homed host configurations


Field Summary
private static java.lang.String defaultHost
           
private static int defaultPort
           
private static java.lang.String defaultProtocol
           
private static boolean defaultsSet
           
private static org.apache.commons.logging.Log logger
           
static java.lang.String PROXY_PORT_PROPERTY
           
 
Constructor Summary
ServiceHost()
           
 
Method Summary
static java.net.URL getBaseURL()
          Returns container base URL in the following form: scheme://host:port/context/.
static java.net.URL getBaseURL(org.apache.axis.MessageContext context)
          Returns container base URL in the following form: scheme://host:port/context/.
static java.net.URL getDefaultBaseURL()
          Returns the default container base URL in the following form: scheme://host:port/context/.
static java.lang.String getDefaultHost()
          Returns the default hostname of the container.
static int getDefaultPort()
          Returns the default port of the container.
static java.lang.String getDefaultProtocol()
          Returns the default protocol of the container.
private static java.net.URL getEndpoint(org.apache.axis.MessageContext messageContext)
           
static java.lang.String getHost()
          Returns the hostname of the container.
static java.lang.String getHost(org.apache.axis.AxisEngine engine)
          Returns the hostname of the container.
static java.lang.String getHost(ContainerConfig config)
          Returns the hostname of the container.
static java.lang.String getHost(org.apache.axis.MessageContext context)
          Returns the hostname of the container.
static int getPort()
          Returns the port number of the container.
static int getPort(org.apache.axis.MessageContext context)
          Returns the port number of the container.
static java.lang.String getProtocol()
          Returns the protocol of the container.
static java.lang.String getProtocol(org.apache.axis.MessageContext context)
          Returns the protocol of the container.
protected static void setDefaults(java.lang.String protocol, java.lang.String host, int port)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROXY_PORT_PROPERTY

public static final java.lang.String PROXY_PORT_PROPERTY
See Also:
Constant Field Values

logger

private static final org.apache.commons.logging.Log logger

defaultsSet

private static boolean defaultsSet

defaultPort

private static int defaultPort

defaultProtocol

private static java.lang.String defaultProtocol

defaultHost

private static java.lang.String defaultHost
Constructor Detail

ServiceHost

public ServiceHost()
Method Detail

setDefaults

protected static void setDefaults(java.lang.String protocol,
                                  java.lang.String host,
                                  int port)

getEndpoint

private static java.net.URL getEndpoint(org.apache.axis.MessageContext messageContext)
                                 throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException

getDefaultBaseURL

public static java.net.URL getDefaultBaseURL()
                                      throws java.io.IOException
Returns the default container base URL in the following form: scheme://host:port/context/. For example: https://localhost:8443/wsrf/services/.
It is recommended to use getBaseURL() function for better chance of getting the right base URL.

Returns:
base URL of the container.
Throws:
java.io.IOException

getBaseURL

public static java.net.URL getBaseURL()
                               throws java.io.IOException
Returns container base URL in the following form: scheme://host:port/context/. For example: https://localhost:8443/wsrf/services/. The container base URL is determined from the transport URL property in MessageContext associated with the current thread. If there is no MessageContext associated with the thread default values will be used for the base URL.

Returns:
base URL of the container.
Throws:
java.io.IOException

getBaseURL

public static java.net.URL getBaseURL(org.apache.axis.MessageContext context)
                               throws java.io.IOException
Returns container base URL in the following form: scheme://host:port/context/. For example: https://localhost:8443/wsrf/services/. The container base URL is determined from the transport URL property in the specified MessageContext object. If the MessageContext parameter is not specified the default values will be used for the base URL.

Parameters:
context - MessageContext object from which to determine the container base URL. Can be null.
Returns:
base URL of the container.
Throws:
java.io.IOException

getDefaultPort

public static int getDefaultPort()
Returns the default port of the container.
It is recommended to use getPort() function for better chance of getting the right port number of the container.

Returns:
the default port of the container.

getPort

public static int getPort()
Returns the port number of the container. The container port is determined from the transport URL property in MessageContext associated with the current thread. If there is no MessageContext associated with the thread the default port number will be returned.

Returns:
the port number of the container.

getPort

public static int getPort(org.apache.axis.MessageContext context)
Returns the port number of the container. The container port is determined from the transport URL property in the specified MessageContext object. If the MessageContext parameter is not specified the default port number will be returned.

Parameters:
context - MessageContext object from which to determine the container port number. Can be null.
Returns:
the port number of the container.

getDefaultProtocol

public static java.lang.String getDefaultProtocol()
Returns the default protocol of the container. For example: http.
It is recommended to use getProtocol() function for better chance of getting the right protocol of the container.

Returns:
the default protocol of the container.

getProtocol

public static java.lang.String getProtocol()
Returns the protocol of the container. For example: http. The container protocol is determined from the transport URL property in MessageContext associated with the current thread. If there is no MessageContext associated with the thread default protocol will be returned.

Returns:
the protocol of the container.

getProtocol

public static java.lang.String getProtocol(org.apache.axis.MessageContext context)
Returns the protocol of the container. For example: http. The container protocol is determined from the transport URL property in the specified MessageContext object. If the MessageContext parameter is not specified the default protocol will be returned.

Parameters:
context - MessageContext object from which to determine the container protocol. Can be null.
Returns:
the protocol of the container.

getDefaultHost

public static java.lang.String getDefaultHost()
                                       throws java.io.IOException
Returns the default hostname of the container.
It is recommended to use getHost() function for better chance of getting the right hostname.

Returns:
the default hostname of the container.
Throws:
java.io.IOException

getHost

public static java.lang.String getHost()
                                throws java.io.IOException
Returns the hostname of the container. The container hostname is determined from the MessageContext associated with the current thread. If there is no MessageContext associated with the thread the default hostname will be returned.

Returns:
the hostname of the container.
Throws:
java.io.IOException

getHost

public static java.lang.String getHost(org.apache.axis.MessageContext context)
                                throws java.io.IOException
Returns the hostname of the container. The container hostname is determined from the specified MessageContext configuration parameter.

Parameters:
context - MessageContext object from which to determine the container hostname. Can be null. If null the default hostname will be returned.
Returns:
the hostname of the container.
Throws:
java.io.IOException

getHost

public static java.lang.String getHost(org.apache.axis.AxisEngine engine)
                                throws java.io.IOException
Returns the hostname of the container. The container hostname is determined from the specified AxisEngine configuration parameter.

Parameters:
engine - AxisEngine object from which to determine the container hostname. Can be null. If null the default hostname will be returned.
Returns:
the hostname of the container.
Throws:
java.io.IOException

getHost

public static java.lang.String getHost(ContainerConfig config)
                                throws java.io.IOException
Returns the hostname of the container. The container hostname is determined from the specified container configuration parameter.

Parameters:
config - ContainerConfig object from which to determine the container hostname. Cannot be null.
Returns:
the hostname of the container.
Throws:
java.io.IOException