Example usage for javax.servlet.http HttpServletResponse setDateHeader

List of usage examples for javax.servlet.http HttpServletResponse setDateHeader

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletResponse setDateHeader.

Prototype

public void setDateHeader(String name, long date);

Source Link

Document

Sets a response header with the given name and date-value.

Usage

From source file:nl.nn.adapterframework.webcontrol.ConfigurationServlet.java

public static void noCache(HttpServletResponse response) {
    response.setDateHeader("Expires", 1);
    response.setDateHeader("Last-Modified", new Date().getTime());
    response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
    response.setHeader("Pragma", "no-cache");
}

From source file:com.ccf.util.ModDateHeaderUtil.java

/**
 * Set the Last-Modified header using the given time in milliseconds.  Note that because the
 * header has the granularity of one second, the value will get truncated to the nearest second that does not
 * exceed the provided value./*from w w w  .java 2  s  .c  o m*/
 * <p/>
 * This will also set the Expires header to a date in the past.  This forces clients to revalidate the cache each
 * time.
 *
 * @param response
 * @param lastModifiedTimeMillis
 */
public static void setLastModifiedHeader(HttpServletResponse response, long lastModifiedTimeMillis) {
    response.setDateHeader("Last-Modified", lastModifiedTimeMillis);
    // Force clients to revalidate each time
    // See RFC 2616 (HTTP 1.1 spec) secs 14.21, 13.2.1
    response.setDateHeader("Expires", 0);
    // We may also want this (See 13.2.1 and 14.9.4)
    // response.setHeader("Cache-Control","must-revalidate");
}

From source file:com.xyz.util.WebUtil.java

/**
 * Header./*from   w w  w. java 2s. co  m*/
 */
public static void setNoCacheHeader(HttpServletResponse response) {
    //Http 1.0 header
    response.setDateHeader("Expires", 0);
    //Http 1.1 header
    response.setHeader("Cache-Control", "max-age=0");
}

From source file:com.eryansky.common.web.utils.WebUtils.java

/**
 * Header.//from   ww  w .  j  a va 2s  .  c  o m
 */
public static void setNoCacheHeader(HttpServletResponse response) {
    // Http 1.0 header
    response.setDateHeader("Expires", 0);
    // Http 1.1 header
    response.setHeader("Cache-Control", "no-cache");
}

From source file:org.agileframework.web.servlet.Servlets.java

/**
 * ?Header.//from   www . j a  v  a 2  s.c o m
 */
public static void setNoCacheHeader(HttpServletResponse response) {
    //Http 1.0 header
    response.setDateHeader(HttpHeaders.EXPIRES, 1L);
    response.addHeader(HttpHeaders.PRAGMA, "no-cache");
    //Http 1.1 header
    response.setHeader(HttpHeaders.CACHE_CONTROL, "no-cache, no-store, max-age=0");
}

From source file:com.dosport.system.utils.ServletUtils.java

/**
 * LastModified Header.//from   w w  w  .  java 2 s. co m
 */
public static void setLastModifiedHeader(HttpServletResponse response, long lastModifiedDate) {
    response.setDateHeader("Last-Modified", lastModifiedDate);
}

From source file:com.gc.core.framework.utils.web.ServletUtils.java

/**
 * ?Header.//from   w w  w.j  a  va 2  s.co m
 */
public static void setDisableCacheHeader(HttpServletResponse response) {
    //Http 1.0 header
    response.setDateHeader("Expires", 1L);
    response.addHeader("Pragma", "no-cache");
    //Http 1.1 header
    response.setHeader("Cache-Control", "no-cache, no-store, max-age=0");
}

From source file:com.handpay.ibenefit.framework.util.WebUtils.java

public static void setLastModifiedHeader(HttpServletResponse response, long lastModifiedDate) {
    response.setDateHeader("Last-Modified", lastModifiedDate);
}

From source file:com.dosport.system.utils.ServletUtils.java

/**
 * ?Header./*from w  w w  .  j  av  a2s. c om*/
 */
public static void setDisableCacheHeader(HttpServletResponse response) {
    // Http 1.0 header
    response.setDateHeader("Expires", 1L);
    response.addHeader("Pragma", "no-cache");
    // Http 1.1 header
    response.setHeader("Cache-Control", "no-cache, no-store, max-age=0");
}

From source file:com.handpay.ibenefit.framework.util.WebUtils.java

public static void setNoCacheHeader(HttpServletResponse response) {
    // Http 1.0 header
    response.setDateHeader("Expires", 0);
    // Http 1.1 header
    response.setHeader("Cache-Control", "no-cache");
}