use of org.glassfish.web.deployment.util.VirtualServerInfo in project Payara by payara.
the class WsUtil method getWebServerInfoForDAS.
public WebServerInfo getWebServerInfoForDAS() {
WebServerInfo wsi = new WebServerInfo();
if (this.networkListeners == null) {
List<Integer> adminPorts = new ArrayList<Integer>();
for (org.glassfish.api.container.Adapter subAdapter : WebServiceContractImpl.getInstance().getAdapters()) {
if (subAdapter instanceof AdminAdapter) {
AdminAdapter aa = (AdminAdapter) subAdapter;
adminPorts.add(aa.getListenPort());
} else if (subAdapter instanceof AdminConsoleAdapter) {
AdminConsoleAdapter aca = (AdminConsoleAdapter) subAdapter;
adminPorts.add(aca.getListenPort());
}
}
for (NetworkListener nl : config.getNetworkConfig().getNetworkListeners().getNetworkListener()) {
if (!adminPorts.contains(Integer.valueOf(nl.getPort()))) {
// get rid of admin ports
if (networkListeners == null)
networkListeners = new ArrayList<NetworkListener>();
networkListeners.add(nl);
}
}
}
// Fix for issue 13107490
if ((networkListeners != null) && (!networkListeners.isEmpty())) {
for (NetworkListener listener : networkListeners) {
String host = listener.getAddress();
if (listener.getAddress().equals("0.0.0.0"))
try {
host = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
// fallback
host = "localhost";
}
if (listener.findHttpProtocol().getSecurityEnabled().equals("false"))
wsi.setHttpVS(new VirtualServerInfo("http", host, Integer.parseInt(listener.getPort())));
else if (listener.findHttpProtocol().getSecurityEnabled().equals("true"))
wsi.setHttpsVS(new VirtualServerInfo("https", host, Integer.parseInt(listener.getPort())));
}
} else {
wsi.setHttpVS(new VirtualServerInfo("http", "localhost", 0));
wsi.setHttpsVS(new VirtualServerInfo("https", "localhost", 0));
}
return wsi;
}
Aggregations