예제 #1
0
  @Override
  public void setContentType(String contentType) {
    super.setHeader("Expires", "-1");
    super.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
    logger.debug("Header changed successfully");

    super.setContentType(contentType);
  }
 @Override
 public void setHeader(String name, String value) {
   if (name.equals(LOCATION)) {
     String newLocation = mapLocation(value.trim());
     super.setHeader(name, newLocation);
   } else {
     super.setHeader(name, value);
   }
 }
예제 #3
0
 /** {@inheritDoc} */
 public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain)
     throws IOException, ServletException {
   HttpServletRequest request = (HttpServletRequest) req;
   HttpServletResponseWrapper response =
       new HttpServletResponseWrapper((HttpServletResponse) resp);
   String encoding = request.getHeader("Accept-Encoding");
   boolean supportsGzip = false;
   // Now, check to see if the browser supports the GZIP compression
   if (encoding != null) {
     if (encoding.toLowerCase().indexOf("gzip") > -1) supportsGzip = true;
   }
   Debug.log(
       "supportsGzip : "
           + supportsGzip
           + ", encoding : "
           + encoding
           + ", requestURL : "
           + request.getRequestURL());
   if (supportsGzip) {
     // add content encoding
     response.setHeader("Content-Encoding", "gzip");
     GzipResponse compressionResponse = new GzipResponse(response);
     chain.doFilter(request, compressionResponse);
     compressionResponse.close();
   } else {
     chain.doFilter(req, resp);
   }
 }
 @Override
 public void setHeader(String name, String value) {
   super.setHeader(name, value);
   headers.put(name, value);
 }