@Override
 public void showLoginPage(HttpServletRequest req, HttpServletResponse resp, String callback)
     throws IOException, ServletException {
   if (Strings.isNullOrEmpty(callback)) {
     callback = CoreConfiguration.getConfiguration().applicationUrl() + "/login.do";
   }
   super.showLoginPage(req, resp, callback);
 }
示例#2
0
 private void populateSiteInfo(
     final HttpServletRequest req, Page page, Site site, TemplateContext context) {
   context.put("request", makeRequestWrapper(req));
   context.put("app", makeAppWrapper());
   context.put("site", site.makeWrap());
   context.put("menus", makeMenuWrapper(site, page));
   context.put("staticDir", site.getStaticDirectory());
   context.put("devMode", CoreConfiguration.getConfiguration().developmentMode());
 }
示例#3
0
 private void handleLeadingSlash(final HttpServletRequest req, HttpServletResponse res, Site sites)
     throws PebbleException, IOException, ServletException {
   if (req.getMethod().equals("GET")) {
     res.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
     res.setHeader("Location", rewritePageUrl(req));
     return;
   } else if (req.getMethod().equals("POST")) {
     if (CoreConfiguration.getConfiguration().developmentMode()) {
       PebbleEngine engine = new PebbleEngine(new StringLoader());
       engine.addExtension(new CMSExtensions());
       PebbleTemplate compiledTemplate =
           engine.getTemplate(
               "<html><head></head><body><h1>POST action with backslash</h1><b>You posting data with a URL with a backslash. Alter the form to post with the same URL without the backslash</body></html>");
       res.setStatus(500);
       res.setContentType("text/html");
       compiledTemplate.evaluate(res.getWriter());
     } else {
       errorPage(req, res, sites, 500);
     }
   }
 }