use of org.apache.tapestry5.http.services.Context 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.http.services.Context in project tapestry-5 by apache.
the class StaticFilesFilterTest method existing_file.
@Test
public void existing_file() throws Exception {
URL url = new URL("file://.");
String path = "/cell.gif";
Request request = newRequest(path);
Response response = mockResponse();
RequestHandler handler = mockRequestHandler();
Context context = mockContext();
train_getResource(context, path, url);
replay();
RequestFilter filter = new StaticFilesFilter(context);
assertFalse(filter.service(request, response, handler));
verify();
}
use of org.apache.tapestry5.http.services.Context in project tapestry-5 by apache.
the class StaticFilesFilterTest method colon_in_path_prevents_static_file_check.
/**
* TAPESTRY-2606
*/
@Test
public void colon_in_path_prevents_static_file_check() throws Exception {
String path = "/start.update:anevent";
Request request = newRequest(path);
Response response = mockResponse();
RequestHandler handler = mockRequestHandler();
Context context = mockContext();
train_service(handler, request, response, true);
replay();
RequestFilter filter = new StaticFilesFilter(context);
assertTrue(filter.service(request, response, handler));
verify();
}
use of org.apache.tapestry5.http.services.Context in project tapestry-5 by apache.
the class StaticFilesFilterTest method existing_template_file_case_insenitive.
@Test
public void existing_template_file_case_insenitive() throws Exception {
URL url = new URL("file://.");
String path = "/cell.TML";
Request request = newRequest(path);
Response response = mockResponse();
RequestHandler handler = mockRequestHandler();
Context context = mockContext();
train_getResource(context, path, url);
response.sendError(HttpServletResponse.SC_FORBIDDEN, "URI /cell.TML may not be accessed remotely.");
replay();
RequestFilter filter = new StaticFilesFilter(context);
assertTrue(filter.service(request, response, handler));
verify();
}
use of org.apache.tapestry5.http.services.Context in project tapestry-5 by apache.
the class StaticFilesFilterTest method request_for_favicon.
@Test
public void request_for_favicon() throws IOException {
Request request = newRequest("/favicon.ico");
Response response = mockResponse();
RequestHandler handler = mockRequestHandler();
Context context = mockContext();
replay();
RequestFilter filter = new StaticFilesFilter(context);
assertFalse(filter.service(request, response, handler));
verify();
}
Aggregations