use of org.apache.tapestry5.http.services.HttpServletRequestHandler in project flowlogix by flowlogix.
the class GwtCachingFilter method service.
@Override
public boolean service(HttpServletRequest request, HttpServletResponse response, HttpServletRequestHandler chainHandler) throws IOException {
String path = request.getServletPath();
boolean neverExpire = checkConfig(path, response);
if (neverExpire == false) {
return chainHandler.service(request, response);
}
log.finer("GwtCachingFilter: Processing " + path);
Request rq = new RequestImpl(request, applicationCharset, sessionFactory);
Response rsp = new ResponseImpl(request, response);
rg.storeRequestResponse(rq, rsp);
rsp.setDateHeader("Expires", new Date().getTime() + InternalConstants.TEN_YEARS);
try {
return carh.handleAssetRequest(rq, rsp, pathProcessor.removeAssetPathPart(path));
} catch (Exception e) {
return chainHandler.service(request, response);
}
}
use of org.apache.tapestry5.http.services.HttpServletRequestHandler in project tapestry-5 by apache.
the class MultipartServletRequestFilterTest method multipartRequestIsDecoded.
@Test
public void multipartRequestIsDecoded() throws Exception {
MultipartDecoder decoder = newMock(MultipartDecoder.class);
HttpServletRequest request = mockHttpServletRequest();
HttpServletRequest decodedRequest = mockHttpServletRequest();
HttpServletResponse response = mockHttpServletResponse();
HttpServletRequestHandler handler = newMock(HttpServletRequestHandler.class);
MultipartServletRequestFilter filter = new MultipartServletRequestFilter(decoder);
expect(request.getMethod()).andReturn("post");
expect(request.getContentType()).andReturn("multipart/form");
expect(decoder.decode(request)).andReturn(decodedRequest);
expect(handler.service(decodedRequest, response)).andReturn(true);
replay();
boolean isHandled = filter.service(request, response, handler);
assertTrue(isHandled);
verify();
}
use of org.apache.tapestry5.http.services.HttpServletRequestHandler 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.HttpServletRequestHandler 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.HttpServletRequestHandler 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();
}
Aggregations