new PortletApplicationConfig();
portletAppConfig.setContextPath(contextPath);
ServletContext portletAppServletContext = servletContext.getContext(contextPath);
if (portletAppServletContext == null) {
throw new DriverAdministrationException(
"Unable to locate servlet context: " + contextPath
+ ": ensure that crossContext support is enabled "
+ "and the portlet application has been deployed.");
}
PortletAppDD portletAppDD = getPortletDescriptor(
portletAppServletContext);
if (portletAppDD == null) {
throw new DriverAdministrationException(
"Unable to retrieve portlet application descriptor from "
+ contextPath + ": ensure that the portlet application "
+ "has been deployed.");
}
for (Iterator it = portletAppDD.getPortlets().iterator();
it.hasNext(); ) {
PortletDD portletDD = (PortletDD) it.next();
PortletWindowConfig portletWindowConfig = new PortletWindowConfig();
portletWindowConfig.setContextPath(contextPath);
portletWindowConfig.setPortletName(portletDD.getPortletName());
portletAppConfig.addPortlet(portletWindowConfig);
}
config.addPortletApp(portletAppConfig);
} catch (PortletContainerException ex) {
throw new DriverAdministrationException(
"Unable to add portlet application from " + contextPath, ex);
}
}