protected Dispatch getDispatch(String path) { HttpServletRequest request = ElementsThreadLocals.getHttpServletRequest(); Dispatcher dispatcher = DispatcherUtil.get(request); return dispatcher != null ? dispatcher.getDispatch(path) : null; }
@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; } }
public static Dispatch getDispatch(Dispatcher dispatcher, HttpServletRequest request) { //TODO ElementsActionBeanContext ElementsActionBeanContext context = new ElementsActionBeanContext(); context.setRequest(request); String originalPath = context.getActionPath(); return dispatcher.getDispatch(originalPath); }
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); } }
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; } }
String contextPath = context.getRequest().getContextPath(); String landingPagePath = portofinoConfiguration.getString(PortofinoProperties.LANDING_PAGE); Dispatch landingPageDispatch = dispatcher.getDispatch(landingPagePath); if(landingPageDispatch != null && landingPageDispatch.getLastPageInstance().getDirectory().equals(pageInstance.getDirectory())) {
String contextPath = context.getRequest().getContextPath(); String landingPagePath = portofinoConfiguration.getString(PortofinoProperties.LANDING_PAGE); Dispatch landingPageDispatch = dispatcher.getDispatch(landingPagePath); if(landingPageDispatch != null && landingPageDispatch.getLastPageInstance().getDirectory().equals(pageInstance.getDirectory())) { Dispatch destinationDispatch = dispatcher.getDispatch(destinationPagePath);