use of org.apache.tapestry5.http.services.RequestFilter in project tapestry-5 by apache.
the class StaticFilesFilterTest method not_a_static_file_request.
@Test
public void not_a_static_file_request() throws Exception {
String path = "/start.update";
Request request = newRequest(path);
Response response = mockResponse();
RequestHandler handler = mockRequestHandler();
Context context = mockContext();
train_getResource(context, path, null);
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.RequestFilter in project tapestry-5 by apache.
the class StaticFilesFilterTest method path_does_not_contain_a_period.
@Test
public void path_does_not_contain_a_period() throws Exception {
Request request = newRequest("/start");
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.RequestFilter in project tapestry-5 by apache.
the class StaticFilesFilterTest method existing_template_file.
@Test
public void existing_template_file() 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();
}
Aggregations