Package javax.servlet.http

Examples of javax.servlet.http.HttpServletResponse.addHeader()


   
    response.setContentType(contentType);
   
    if (!cacheable) {
      response.setHeader("Pragma", "no-cache");      
      response.addHeader("Cache-Control", "no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
      response.setDateHeader ("Expires", 1);
    }
    else {
      response.setHeader("Cache-Control", "max-age=" + (cacheHoldingTime / 1000));
      response.setDateHeader ("Expires", System.currentTimeMillis () + cacheHoldingTime);
View Full Code Here


  public void doFilter(ServletRequest request, ServletResponse response)
    throws ServletException, IOException
  {
    HttpServletResponse res = (HttpServletResponse) response;

    res.addHeader(_name, _value);

    _next.doFilter(request, response);
  }
}
View Full Code Here

    throws ServletException, IOException
  {
    if (_cacheTime > 0) {
      HttpServletResponse res = (HttpServletResponse) response;

      res.addHeader("Cache-Control", "max-age=" + (_cacheTime / 1000));
     
      res.setDateHeader("Expires", Alarm.getCurrentTime() + _cacheTime);
    }

    nextFilter.doFilter(request, response);
View Full Code Here

    String ifMatch = req.getHeader("If-None-Match");
    String etag = cache.getEtag();

    if (ifMatch != null && ifMatch.equals(etag)) {
      res.addHeader("ETag", etag);
      res.sendError(HttpServletResponse.SC_NOT_MODIFIED);
      return;
    }

    String lastModified = cache.getLastModifiedString();
View Full Code Here

                      || ifModifiedTime != cache.getLastModified());
      }

      if (! isModified) {
        if (etag != null)
          res.addHeader("ETag", etag);
        res.sendError(HttpServletResponse.SC_NOT_MODIFIED);
        return;
      }
    }
View Full Code Here

        res.sendError(HttpServletResponse.SC_NOT_MODIFIED);
        return;
      }
    }

    res.addHeader("ETag", etag);
    res.addHeader("Last-Modified", lastModified);
   
    if (_isEnableRange && cauchoReq != null && cauchoReq.isTop())
      res.addHeader("Accept-Ranges", "bytes");
View Full Code Here

        return;
      }
    }

    res.addHeader("ETag", etag);
    res.addHeader("Last-Modified", lastModified);
   
    if (_isEnableRange && cauchoReq != null && cauchoReq.isTop())
      res.addHeader("Accept-Ranges", "bytes");

    if (_characterEncoding != null)
View Full Code Here

    res.addHeader("ETag", etag);
    res.addHeader("Last-Modified", lastModified);
   
    if (_isEnableRange && cauchoReq != null && cauchoReq.isTop())
      res.addHeader("Accept-Ranges", "bytes");

    if (_characterEncoding != null)
      res.setCharacterEncoding(_characterEncoding);

    String mime = cache.getMimeType();
View Full Code Here

    throws ServletException, IOException
  {
    if (_cacheTime > 0) {
      HttpServletResponse res = (HttpServletResponse) response;
     
      res.addHeader("Vary", "Cookie");
      res.addHeader("Cache-Control", "s-maxage=" + _cacheTime);
    }

    nextFilter.doFilter(request, response);
  }
View Full Code Here

  {
    if (_cacheTime > 0) {
      HttpServletResponse res = (HttpServletResponse) response;
     
      res.addHeader("Vary", "Cookie");
      res.addHeader("Cache-Control", "s-maxage=" + _cacheTime);
    }

    nextFilter.doFilter(request, response);
  }
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.