return headers;
}
public WebServerInfo getWebServerInfoForDAS() {
WebServerInfo wsi = new WebServerInfo();
if(this.networkListeners == null) {
List<Integer> adminPorts = new ArrayList<Integer>();
for (org.glassfish.api.container.Adapter subAdapter :
habitat.getAllByContract(org.glassfish.api.container.Adapter.class)) {
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);
}
}
}
for(NetworkListener listener : networkListeners) {
String host = listener.getAddress();
if(listener.getAddress().equals("0.0.0.0"))
try {
host = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
host="localhost"; //fallback
}
else {
// TODO - resolve to hostname; it should be optional and turned off
// by default
// try {
// host = InetAddress.getByName(listener.getAddress()).getHostName();
// } catch (UnknownHostException ex) {
// // silently ignore
// }
}
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())));
}
return wsi;
}