public static Dispatch getDispatch(HttpServletRequest request) { Dispatcher dispatcher = get(request); return getDispatch(dispatcher, request); }
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain ) throws IOException, ServletException { // cast to http type HttpServletRequest httpRequest = (HttpServletRequest) request; logger.debug("Installing the dispatcher in the http current request"); DispatcherUtil.install(httpRequest); chain.doFilter(request, response); }
protected Dispatch getDispatch(String path) { HttpServletRequest request = ElementsThreadLocals.getHttpServletRequest(); Dispatcher dispatcher = DispatcherUtil.get(request); return dispatcher != null ? dispatcher.getDispatch(path) : null; }
public Resolution intercept(ExecutionContext context) throws Exception { logger.debug("Retrieving Stripes objects"); ActionBeanContext actionContext = context.getActionBeanContext(); ActionBean actionBean = context.getActionBean(); Method handler = context.getHandler(); logger.debug("Retrieving Servlet API objects"); HttpServletRequest request = actionContext.getRequest(); Dispatch dispatch = DispatcherUtil.getDispatch(request); if(SecurityLogic.isAllowed(request, dispatch, actionBean, handler)) { logger.debug("Security check passed."); return context.proceed(); } else { return new ForbiddenAccessResolution(); } }
@Path(":pages") @GET @Produces(MimeTypes.APPLICATION_JSON_UTF8) public NavigationItem getPages() { Configuration configuration = (Configuration) servletContext.getAttribute(BaseModule.PORTOFINO_CONFIGURATION); String landingPage = configuration.getString(PortofinoProperties.LANDING_PAGE); if(landingPage != null) { HttpServletRequest request = ElementsThreadLocals.getHttpServletRequest(); return new Navigation( configuration, DispatcherUtil.get(request).getDispatch(landingPage), SecurityUtils.getSubject(), false). getRootNavigationItem(); } else { return null; } }
ognlContext.put("textProvider", new TextProviderBean(ElementsThreadLocals.getTextProvider())); Dispatch dispatch = DispatcherUtil.getDispatch(actionContext); if (dispatch != null) { HttpServletRequest request = actionContext.getRequest();
public static Dispatch getDispatch(ActionBeanContext context) { HttpServletRequest request = context.getRequest(); Dispatcher dispatcher = get(request); if(context instanceof ElementsActionBeanContext) { String actionPath = ((ElementsActionBeanContext) context).getActionPath(); return dispatcher.getDispatch(actionPath); } else { return getDispatch(request); } }
@Before public Resolution prepare() { Dispatcher dispatcher = DispatcherUtil.get(context.getRequest()); dispatch = dispatcher.getDispatch(originalPath); try{ pageInstance = dispatch.getLastPageInstance(); }catch (Exception e){ logger.warn(e.getMessage()); return new ForbiddenAccessResolution(); } if(pageInstance==null || !SecurityLogic.hasPermissions( portofinoConfiguration, pageInstance, SecurityUtils.getSubject(), AccessLevel.EDIT)) { return new ForbiddenAccessResolution(); } else { return null; } }
@Override protected ActionBean makeNewActionBean( Class<? extends ActionBean> type, ActionBeanContext context) throws Exception { Dispatch dispatch = DispatcherUtil.getDispatch(context.getRequest()); if(dispatch != null) { PageInstance pageInstance = dispatch.getLastPageInstance(); if(type.equals(pageInstance.getActionClass())) { if(pageInstance.getActionBean() != null) { return pageInstance.getActionBean(); } else { assert false; if(DispatcherLogic.isValidActionClass(type)) { ActionBean actionBean = super.makeNewActionBean(type, context); pageInstance.setActionBean((PageAction) actionBean); return actionBean; } else { throw new Exception("Invalid action bean type for dispatch: " + type); //TODO } } } } return super.makeNewActionBean(type, context); }
public static Dispatch getDispatch(HttpServletRequest request, Object actionBean) { Dispatcher dispatcher = get(request); if(actionBean instanceof AbstractActionBean) { String actionPath = ((AbstractActionBean) actionBean).getContext().getActionPath(); return dispatcher.getDispatch(actionPath); } else { return getDispatch(request); } }
return new ForbiddenAccessResolution("You are not authorized to delete this page."); Dispatcher dispatcher = DispatcherUtil.get(context.getRequest()); String contextPath = context.getRequest().getContextPath(); String landingPagePath = portofinoConfiguration.getString(PortofinoProperties.LANDING_PAGE);
Dispatcher dispatcher = DispatcherUtil.get(context.getRequest()); String contextPath = context.getRequest().getContextPath(); String landingPagePath = portofinoConfiguration.getString(PortofinoProperties.LANDING_PAGE); Dispatcher dispatcher = DispatcherUtil.get(context.getRequest()); Dispatch destinationDispatch = dispatcher.getDispatch(destinationPagePath);