PortletApplicationDefinition portletApp = null;
try {
InputStream paIn = servletContext.getResourceAsStream(PORTLET_XML);
InputStream webIn = servletContext.getResourceAsStream(WEB_XML);
if (paIn == null) {
throw new PortletContainerException("Cannot find '" + PORTLET_XML +
"'. Are you sure it is in the deployed package?");
}
if (webIn == null) {
throw new PortletContainerException("Cannot find '" + WEB_XML +
"'. Are you sure it is in the deployed package?");
}
portletApp = portletDDService.read(name, contextPath, paIn);
portletDDService.mergeWebDescriptor(portletApp, webIn);
} catch (Exception ex) {
throw new PortletContainerException(EXCEPTIONS.getString(
"error.context.descriptor.load",
new String[] { servletContext.getServletContextName() }),
ex);
}
return portletApp;