@Test public void page_activation_context_in_request() throws Exception { ComponentRequestHandler handler = mockComponentRequestHandler(); Request request = mockRequest(); Response response = mockResponse(); ComponentClassResolver resolver = mockComponentClassResolver(); LocalizationSetter ls = mockLocalizationSetter(); MetaDataLocator metaDataLocator = neverWhitelistProtected(); ComponentEventRequestParameters expectedParameters = new ComponentEventRequestParameters( "mypage", "mypage", "", "eventname", new URLEventContext(contextValueEncoder, new String[] {"alpha", "beta"}), new EmptyEventContext()); train_getPath(request, "/mypage:eventname"); expect(ls.isSupportedLocaleName("mypage:eventname")).andReturn(false); train_isPageName(resolver, "mypage", true); train_canonicalizePageName(resolver, "mypage", "mypage"); train_getParameter(request, InternalConstants.PAGE_CONTEXT_NAME, "alpha/beta"); train_getParameter(request, InternalConstants.CONTAINER_PAGE_NAME, null); expect(request.getAttribute(InternalConstants.REFERENCED_COMPONENT_NOT_FOUND)).andStubReturn(null); train_for_request_locale(request, ls); handler.handleComponentEvent(expectedParameters); replay(); Dispatcher dispatcher = new ComponentEventDispatcher(handler, new ComponentEventLinkEncoderImpl(resolver, contextPathEncoder, ls, response, null, null, null, true, null, "", metaDataLocator, null)); assertTrue(dispatcher.dispatch(request, response)); verify(); }
public boolean dispatch(Request request, Response response) throws IOException { ComponentEventRequestParameters parameters = linkEncoder.decodeComponentEventRequest(request); if (parameters == null) return false; componentRequestHandler.handleComponentEvent(parameters); if (request.getAttribute(InternalConstants.REFERENCED_COMPONENT_NOT_FOUND) != null) { return false; } return true; }
ComponentEventDispatcher implements Dispatcher { public boolean dispatch(Request request, Response response) throws IOException { ComponentEventRequestParameters parameters = linkEncoder.decodeComponentEventRequest(request); if (parameters == null) return false; componentRequestHandler.handleComponentEvent(parameters); if (request.getAttribute(InternalConstants.REFERENCED_COMPONENT_NOT_FOUND) != null) { return false; } return true; } }
ComponentEventDispatcher implements Dispatcher { public boolean dispatch(Request request, Response response) throws IOException { ComponentEventRequestParameters parameters = linkEncoder.decodeComponentEventRequest(request); if (parameters == null) return false; componentRequestHandler.handleComponentEvent(parameters); if (request.getAttribute(InternalConstants.REFERENCED_COMPONENT_NOT_FOUND) != null) { return false; } return true; } ComponentEventDispatcher(ComponentRequestHandler componentRequestHandler,
                                    ComponentEventLinkEncoder linkEncoder); }
ComponentEventDispatcher implements Dispatcher { public boolean dispatch(Request request, Response response) throws IOException { ComponentEventRequestParameters parameters = linkEncoder.decodeComponentEventRequest(request); if (parameters == null) return false; componentRequestHandler.handleComponentEvent(parameters); if (request.getAttribute(InternalConstants.REFERENCED_COMPONENT_NOT_FOUND) != null) { return false; } return true; } ComponentEventDispatcher(ComponentRequestHandler componentRequestHandler,
                                    ComponentEventLinkEncoder linkEncoder); boolean dispatch(Request request, Response response); }
ComponentEventDispatcher implements Dispatcher { public boolean dispatch(Request request, Response response) throws IOException { ComponentEventRequestParameters parameters = linkEncoder.decodeComponentEventRequest(request); if (parameters == null) return false; componentRequestHandler.handleComponentEvent(parameters); if (request.getAttribute(InternalConstants.REFERENCED_COMPONENT_NOT_FOUND) != null) { return false; } return true; } ComponentEventDispatcher(ComponentRequestHandler componentRequestHandler,
                                    ComponentEventLinkEncoder linkEncoder); boolean dispatch(Request request, Response response);  }