private void doList(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException {
WebManager[] managers = PortletManager.getWebManagers(renderRequest);
List all = new ArrayList();
for (int i = 0; i < managers.length; i++) {
WebManager manager = managers[i];
AbstractName webManagerName = PortletManager.getNameFor(renderRequest, manager);
WebContainer[] containers = (WebContainer[]) manager.getContainers();
for (int j = 0; j < containers.length; j++) {
List beans = new ArrayList();
WebContainer container = containers[j];
AbstractName containerName = PortletManager.getNameFor(renderRequest, container);
String id;
if(containers.length == 1) {
id = manager.getProductName();
} else {
id = manager.getProductName() + " (" + containerName.getName().get(NameFactory.J2EE_NAME) + ")";
}
ContainerInfo result = new ContainerInfo(id, webManagerName.toString(), containerName.toString());
WebConnector[] connectors = (WebConnector[]) manager.getConnectorsForContainer(container);
for (int k = 0; k < connectors.length; k++) {
WebConnector connector = connectors[k];
ConnectorInfo info = new ConnectorInfo();
AbstractName connectorName = PortletManager.getNameFor(renderRequest, connector);
info.setConnectorURI(connectorName.toString());
info.setDescription(PortletManager.getGBeanDescription(renderRequest, connectorName));
info.setDisplayName((String)connectorName.getName().get(NameFactory.J2EE_NAME));
info.setState(((GeronimoManagedBean)connector).getState());
info.setPort(connector.getPort());
try {
info.setProtocol(connector.getProtocol());
} catch (IllegalStateException e) {
info.setProtocol("unknown");
}
beans.add(info);
}
result.setConnectors(beans);
result.setProtocols(manager.getSupportedProtocols());
all.add(result);
}
}
renderRequest.setAttribute("containers", all);
renderRequest.setAttribute("serverPort", new Integer(renderRequest.getServerPort()));