Search in sources :

Example 1 with ResponseImpl

use of org.apache.tapestry5.http.internal.services.ResponseImpl 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);
    }
}
Also used : Response(org.apache.tapestry5.services.Response) HttpServletResponse(javax.servlet.http.HttpServletResponse) HttpServletRequest(javax.servlet.http.HttpServletRequest) Request(org.apache.tapestry5.services.Request) RequestImpl(org.apache.tapestry5.internal.services.RequestImpl) ResponseImpl(org.apache.tapestry5.internal.services.ResponseImpl) Date(java.util.Date) IOException(java.io.IOException)

Example 2 with ResponseImpl

use of org.apache.tapestry5.http.internal.services.ResponseImpl in project tapestry-5 by apache.

the class ResponseImplTest method addHeader.

@Test
public void addHeader() {
    final String HEADER_NAME = "Header-Name";
    final String[] HEADER_VALUES = { "asdfasdf", "FHDFGH", "####" };
    final HttpServletResponse httpServletResponse = mockHttpServletResponse();
    final HttpServletRequest httpServletRequest = mockHttpServletRequest();
    Response response = new ResponseImpl(httpServletRequest, httpServletResponse);
    for (String value : HEADER_VALUES) {
        httpServletResponse.addHeader(HEADER_NAME, value);
    }
    replay();
    for (String value : HEADER_VALUES) {
        response.addHeader(HEADER_NAME, value);
    }
    verify();
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) HttpServletResponse(javax.servlet.http.HttpServletResponse) Response(org.apache.tapestry5.http.services.Response) HttpServletResponse(javax.servlet.http.HttpServletResponse) ResponseImpl(org.apache.tapestry5.http.internal.services.ResponseImpl) Test(org.testng.annotations.Test)

Aggregations

HttpServletRequest (javax.servlet.http.HttpServletRequest)2 HttpServletResponse (javax.servlet.http.HttpServletResponse)2 IOException (java.io.IOException)1 Date (java.util.Date)1 ResponseImpl (org.apache.tapestry5.http.internal.services.ResponseImpl)1 Response (org.apache.tapestry5.http.services.Response)1 RequestImpl (org.apache.tapestry5.internal.services.RequestImpl)1 ResponseImpl (org.apache.tapestry5.internal.services.ResponseImpl)1 Request (org.apache.tapestry5.services.Request)1 Response (org.apache.tapestry5.services.Response)1 Test (org.testng.annotations.Test)1