use of org.apache.tapestry5.http.services.HttpServletRequestFilter in project tapestry-5 by apache.
the class TapestryHttpModule method contributeHttpServletRequestHandler.
/**
* <dl>
* <dt>StoreIntoGlobals</dt>
* <dd>Stores the request and response into {@link org.apache.tapestry5.http.services.RequestGlobals} at the start of the
* pipeline</dd>
* <dt>IgnoredPaths</dt>
* <dd>Identifies requests that are known (via the IgnoredPathsFilter service's configuration) to be mapped to other
* applications</dd>
* <dt>GZip</dt>
* <dd>Handles GZIP compression of response streams (if supported by client)</dd>
* </dl>
*/
public void contributeHttpServletRequestHandler(OrderedConfiguration<HttpServletRequestFilter> configuration, @Symbol(TapestryHttpSymbolConstants.GZIP_COMPRESSION_ENABLED) boolean gzipCompressionEnabled, @Autobuild GZipFilter gzipFilter) {
HttpServletRequestFilter storeIntoGlobals = new HttpServletRequestFilter() {
public boolean service(HttpServletRequest request, HttpServletResponse response, HttpServletRequestHandler handler) throws IOException {
requestGlobals.storeServletRequestResponse(request, response);
return handler.service(request, response);
}
};
configuration.add("StoreIntoGlobals", storeIntoGlobals, "before:*");
configuration.add("GZIP", gzipCompressionEnabled ? gzipFilter : null);
}
use of org.apache.tapestry5.http.services.HttpServletRequestFilter in project tapestry-5 by apache.
the class IgnoredPathsFilterTest method path_excluded.
@Test
public void path_excluded() throws Exception {
HttpServletRequest request = mockHttpServletRequest();
HttpServletResponse response = mockHttpServletResponse();
HttpServletRequestHandler handler = mockHttpServletRequestHandler();
train_getServletPath(request, "/");
train_getPathInfo(request, "barney/rubble");
List<String> configuration = CollectionFactory.newList("/barney.*");
replay();
HttpServletRequestFilter filter = new IgnoredPathsFilter(configuration);
assertFalse(filter.service(request, response, handler));
verify();
}
use of org.apache.tapestry5.http.services.HttpServletRequestFilter in project tapestry-5 by apache.
the class IgnoredPathsFilterTest method no_path_info.
@Test
public void no_path_info() throws Exception {
HttpServletRequest request = mockHttpServletRequest();
HttpServletResponse response = mockHttpServletResponse();
HttpServletRequestHandler handler = mockHttpServletRequestHandler();
train_getServletPath(request, "/");
train_getPathInfo(request, null);
train_service(handler, request, response, true);
List<String> configuration = CollectionFactory.newList("/fred");
replay();
HttpServletRequestFilter filter = new IgnoredPathsFilter(configuration);
assertTrue(filter.service(request, response, handler));
verify();
}
use of org.apache.tapestry5.http.services.HttpServletRequestFilter in project tapestry-5 by apache.
the class IgnoredPathsFilterTest method no_match.
@Test
public void no_match() throws IOException {
HttpServletRequest request = mockHttpServletRequest();
HttpServletResponse response = mockHttpServletResponse();
HttpServletRequestHandler handler = mockHttpServletRequestHandler();
train_getServletPath(request, "/");
train_getPathInfo(request, "barney");
train_service(handler, request, response, true);
List<String> configuration = CollectionFactory.newList("/fred");
replay();
HttpServletRequestFilter filter = new IgnoredPathsFilter(configuration);
assertTrue(filter.service(request, response, handler));
verify();
}
Aggregations