public void prePopulateRealm(HttpServletRequest request) { RequestScopeSuperBean rssb = RequestScopeSuperBean.createAndAttach(request, wac); PrePopulateBean ppBean = rssb.getPrePopulateBean(); ppBean.doPrepopulate(); }
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { execute(request, response); } finally { RequestScopeSuperBean.clearInstance(); } }
/* * (non-Javadoc) * * @see uk.ac.cam.caret.sakai.rwiki.tool.command.Dispatcher#dispatch(java.lang.String, * javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletResponse) */ public void dispatch(String path, HttpServletRequest request, HttpServletResponse response) throws ServletException { VelocityContext vcontext = new VelocityContext(); // EventCartridge ec = new EventCartridge(); // ec.addEventHandler(new ExcludeEscapeHtmlReference()); // ec.attachToContext(vcontext); vcontext.put("session", request.getSession()); vcontext.put("request", request); vcontext.put("requestScope", RequestScopeSuperBean.getFromRequest(request)); vcontext.put("util", utilBean); try { String filePath = path + ".vm"; response.setContentType("text/html"); response.setCharacterEncoding("UTF-8"); vengine.mergeTemplate(filePath, vcontext, response.getWriter()); } catch (MethodInvocationException e) { Throwable cause = e.getWrappedThrowable(); if (cause instanceof PermissionException) { try { String filePath = "/WEB-INF/vm/permission.vm"; response.setContentType("text/html"); response.setCharacterEncoding("UTF-8"); vengine.mergeTemplate(filePath, vcontext, response.getWriter()); } catch (Exception ex) { throw new ServletException(ex); } } else { throw new ServletException(e); } } catch (Exception e) { throw new ServletException(e); } }
public ViewBean newViewBean(RequestScopeSuperBean rssb) { ViewBean vb = new ViewBean(); vb.setLocalSpace(rssb.getCurrentLocalSpace()); return vb; }