// the listener is started
ArrayList<VirtualServer> virtualServers =
getVirtualServersForHttpListenerId(httpService,
httpListener.getId());
if (virtualServers != null) {
Mapper mapper = connector.getMapper();
Server serverBean = null;
try {
serverBean = ServerBeansFactory.getServerBean(configContext);
} catch (ConfigException e) {
_logger.log(Level.SEVERE, "webcontainer.configError", e);
}
for (Iterator<VirtualServer> it = virtualServers.iterator();
it.hasNext(); ) {
VirtualServer vs = it.next();
boolean found = false;
int[] ports = vs.getPorts();
for (int i=0; i<ports.length; i++) {
if (ports[i] == connector.getPort()) {
found = true;
break;
}
}
if (!found) {
int[] newPorts = new int[ports.length + 1];
System.arraycopy(ports, 0, newPorts, 0, ports.length);
newPorts[ports.length] = connector.getPort();
vs.setPorts(newPorts);
}
// Check if virtual server has default-web-module configured,
// and if so, configure the http listener's mapper with this
// information
String defaultWebModulePath = vs.getDefaultContextPath(serverBean);
if (defaultWebModulePath != null) {
try {
mapper.setDefaultContextPath(vs.getName(),
defaultWebModulePath);
vs.setDefaultContextPath(defaultWebModulePath);
} catch (Exception e) {
throw new LifecycleException(e);
}