use of org.apache.tapestry5.services.PageRenderRequestHandler in project tapestry-5 by apache.
the class PageRenderRequestHandlerImplTest method loopback_request.
@Test
public void loopback_request() throws Exception {
RequestPageCache cache = mockRequestPageCache();
ComponentEventResultProcessor processor = mockComponentEventResultProcessor();
PageResponseRenderer renderer = mockPageResponseRenderer();
Page page = mockPage();
EventContext context = mockEventContext();
ComponentPageElement root = mockComponentPageElement();
InternalComponentResources pageResources = mockInternalComponentResources();
PageActivator activator = newMock(PageActivator.class);
Request request = mockRequest();
train_getAttribute(request, InternalConstants.BYPASS_ACTIVATION, null);
train_get(cache, "foo/Bar", page);
train_getRootElement(page, root);
train_getComponentResources(root, pageResources);
expect(activator.activatePage(pageResources, context, processor)).andReturn(false);
// Skips the pageReset()
renderer.renderPageResponse(page);
replay();
PageRenderRequestHandler handler = new PageRenderRequestHandlerImpl(cache, processor, renderer, activator, request);
PageRenderRequestParameters parameters = new PageRenderRequestParameters("foo/Bar", context, true);
handler.handle(parameters);
verify();
}
use of org.apache.tapestry5.services.PageRenderRequestHandler in project tapestry-5 by apache.
the class TapestryModule method contributePageRenderRequestHandler.
/**
* Contributes a single filter, "Secure", which checks for non-secure
* requests that access secure pages.
*/
public void contributePageRenderRequestHandler(OrderedConfiguration<PageRenderRequestFilter> configuration, final RequestSecurityManager securityManager) {
PageRenderRequestFilter secureFilter = new PageRenderRequestFilter() {
public void handle(PageRenderRequestParameters parameters, PageRenderRequestHandler handler) throws IOException {
if (securityManager.checkForInsecurePageRenderRequest(parameters))
return;
handler.handle(parameters);
}
};
configuration.add("Secure", secureFilter);
}
Aggregations