if(debug) {
System.out.println("<VERBOSE> Creating Servlet Wrapper for Portlet: '"+portlet.getPortletName()+"'");
}
String pnm = portlet.getPortletName();
// check if already exists
ServletDD servlet = webApp.getServlet(pnm);
if (servlet != null) {
String cl = servlet.getServletClass();
if (!INVOKER_SERVLET.equals(cl)) {
System.out.println(
"Note: Replaced already existing the servlet with the name '"
+ pnm
+ "' with the wrapper servlet."
);
servlet.setServletClass(INVOKER_SERVLET);
}
} else {
servlet = new ServletDD();
servlet.setServletName(pnm);
servlet.setServletClass(INVOKER_SERVLET);
webApp.getServlets().add(servlet);
}
servlet.setDisplayName(pnm + "Wrapper (Pluto Invoker)");
servlet.setDescription("Auto Generated Portlet Invoker Servlet");
InitParamDD param = new InitParamDD();
param.setParamName("portlet-class");
param.setParamValue(portlet.getPortletClass());
servlet.getInitParams().add(param);
param = new InitParamDD();
param.setParamName("portlet-guid");
param.setParamValue(portletAppDescriptorService.getContextPath()+"."+portlet.getPortletName());
servlet.getInitParams().add(param);
createSecurityRoleRefs(webApp, servlet, portlet);
}