use of org.apache.tapestry5.internal.services.RequestImpl 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.internal.services.RequestImpl in project tapestry-5 by apache.
the class RequestImplTest method used_encoding_from_request.
@Test
public void used_encoding_from_request() throws Exception {
HttpServletRequest sr = mockHttpServletRequest();
expect(sr.getCharacterEncoding()).andReturn("request-encoding");
sr.setCharacterEncoding("request-encoding");
expect(sr.getParameterNames()).andReturn(Collections.enumeration(Collections.EMPTY_LIST));
replay();
new RequestImpl(sr, "app-encoding-is-ignored", null).getParameterNames();
verify();
}
use of org.apache.tapestry5.internal.services.RequestImpl in project tapestry-5 by apache.
the class RequestImplTest method set_encoding_failure.
@Test
public void set_encoding_failure() throws Exception {
HttpServletRequest sr = mockHttpServletRequest();
String encoding = "the-encoding";
UnsupportedEncodingException exception = new UnsupportedEncodingException("Oops.");
sr.setCharacterEncoding(encoding);
setThrowable(exception);
expect(sr.getCharacterEncoding()).andReturn(null);
replay();
try {
new RequestImpl(sr, encoding, null).getParameterNames();
unreachable();
} catch (RuntimeException ex) {
assertSame(ex.getCause(), exception);
}
verify();
}
use of org.apache.tapestry5.internal.services.RequestImpl in project tapestry-5 by apache.
the class RequestImplTest method request_secure_with_x_forwarded_proto.
@Test
public void request_secure_with_x_forwarded_proto() throws Exception {
HttpServletRequest sr = mockHttpServletRequest();
expect(sr.isSecure()).andReturn(false);
expect(sr.getHeader(Request.X_FORWARDED_PROTO_HEADER)).andReturn("https");
replay();
Request request = new RequestImpl(sr, CHARSET, null);
assertTrue(request.isSecure());
verify();
}
use of org.apache.tapestry5.internal.services.RequestImpl in project tapestry-5 by apache.
the class RequestImplTest method get_session_doesnt_exist.
@Test
public void get_session_doesnt_exist() {
HttpServletRequest sr = mockHttpServletRequest();
TapestrySessionFactory sf = newMock(TapestrySessionFactory.class);
expect(sf.getSession(false)).andReturn(null);
replay();
Request request = new RequestImpl(sr, CHARSET, sf);
assertNull(request.getSession(false));
verify();
}
Aggregations