1 13 package info.magnolia.module.admininterface; 14 15 import info.magnolia.cms.servlets.MVCServlet; 16 import info.magnolia.cms.servlets.MVCServletHandler; 17 import info.magnolia.cms.util.RequestFormUtil; 18 19 import javax.servlet.http.HttpServletRequest ; 20 import javax.servlet.http.HttpServletResponse ; 21 22 import org.apache.commons.lang.StringUtils; 23 import org.apache.log4j.Logger; 24 25 26 30 public class DialogPageMVCServlet extends MVCServlet { 31 32 35 private static final long serialVersionUID = 222L; 36 37 40 private static Logger log = Logger.getLogger(DialogPageMVCServlet.class); 41 42 45 protected MVCServletHandler getHandler(HttpServletRequest request, HttpServletResponse response) { 46 47 String pageName = RequestFormUtil.getParameter(request, "mgnlPage"); if (StringUtils.isEmpty(pageName)) { 49 pageName = (String ) request.getAttribute("javax.servlet.include.request_uri"); if (StringUtils.isEmpty(pageName)) { 51 pageName = (String ) request.getAttribute("javax.servlet.forward.servlet_path"); } 53 if (StringUtils.isEmpty(pageName)) { 54 pageName = request.getRequestURI(); 55 } 56 pageName = StringUtils.replaceOnce(StringUtils.substringAfterLast(pageName, "/dialogpages/"), ".html", StringUtils.EMPTY); 58 } 59 60 DialogPageMVCHandler handler = null; 61 62 if (pageName != null) { 63 try { 65 handler = Store.getInstance().getDialogPageHandler(pageName, request, response); 66 } 67 catch (InvalidDialogPageHandlerException e) { 68 log.error("no dialogpage found: " + pageName); } 70 } 71 else { 72 log.error("no dialogpage name passed"); } 74 75 return handler; 76 } 77 78 } | Popular Tags |