Methods Summary |
---|
public static java.lang.String | getDefaultVirtualServerHostAndPort(boolean secure)Get the hostname and port of the secure or non-secure http listener for the default
virtual server in this server instance. The string representation will be of the
form 'hostname:port'.
final String host = getHostName();
final String port = getPort(secure);
if ((host == null) || (port == null)) {
return null;
}
return host + ":" + port;
|
private static java.lang.String | getHostName()Lookup the canonical host name of the system this server instance is running on.
// this value is calculated from InetAddress.getCanonicalHostName when the AS is
// installed. asadmin then passes this value as a system property when the server
// is started.
return System.getProperty(SystemPropertyConstants.HOST_NAME_PROPERTY);
|
private static java.lang.String | getPort(boolean secure)Get the http/https port number for the default virtual server of this server instance.
If the 'secure' parameter is true, then return the secure http listener port, otherwise
return the non-secure http listener port.
try {
ConfigContext configContext = ApplicationServer.getServerContext().getConfigContext();
final String serverName = System.getProperty(SystemPropertyConstants.SERVER_NAME);
Config config = ServerHelper.getConfigForServer(configContext, serverName);
final HttpListener[] listeners = config.getHttpService().getHttpListener();
for (HttpListener listener : listeners) {
if ((secure) && (listener.isSecurityEnabled())) {
return listener.getPort();
} else if ((!secure) && (!listener.isSecurityEnabled())) {
return listener.getPort();
}
}
} catch (Throwable t) {
// error condition handled in wsit code
logger.log(Level.FINEST, "Exception occurred retrieving port " +
"configuration for WSTX service", t);
}
return null;
|