@Override public DispatchElement consumePathFragment(String pathFragment) { PageAction subpage = DispatcherLogic.getSubpage(configuration, pageInstance, pathFragment); HttpServletRequest request = ElementsThreadLocals.getHttpServletRequest(); Injections.inject(subpage, request.getServletContext(), request); return subpage; }
/** * This is called to process a piece (fragment) of the requested URL. If the fragment matches a child page, that * page is instantiated and initialized. Otherwise, the fragment is taken to be a parameter for the current page. * Subclasses can override this method if they want to handle child pages differently (e.g. having them stored * elsewhere). * @param pathFragment the fragment to process. In path /foo/bar/baz, foo, bar and baz are three different fragments. * @return the object that will potentially continue path dispatch if there are other fragments to consume. This is * either a child page or <code>this</code>. A null return value means that the dispatch failed (no child page * exists and this page does not accept parameters). */ @Override public DispatchElement consumePathFragment(String pathFragment) { boolean acceptsPathParameter = acceptsPathParameter(); if(!acceptsPathParameter || pageInstance.getParameters().isEmpty()) { PageAction subpage = DispatcherLogic.getSubpage(portofinoConfiguration, pageInstance, pathFragment); if (subpage != null) { HttpServletRequest request = ElementsThreadLocals.getHttpServletRequest(); Injections.inject(subpage, request.getServletContext(), request); return subpage; } } if(acceptsPathParameter) { pageInstance.getParameters().add(pathFragment); return this; } else { return null; } }
PageAction subpage = DispatcherLogic.getSubpage(configuration, pageInstance, pathFragment); if(subpage == null) { logger.error("Page not found: {}", pathFragment);