Example usage for com.google.common.net HttpHeaders PRAGMA

List of usage examples for com.google.common.net HttpHeaders PRAGMA

Introduction

In this page you can find the example usage for com.google.common.net HttpHeaders PRAGMA.

Prototype

String PRAGMA

To view the source code for com.google.common.net HttpHeaders PRAGMA.

Click Source Link

Document

The HTTP Pragma header field name.

Usage

From source file:com.google.testing.security.firingrange.utils.Responses.java

/**
 * Sends a "normal" response, with all the standard headers. 
 *///w  ww.j  a v  a  2s  .c om
public static void sendNormalPage(HttpServletResponse response, String body) throws IOException {
    response.setHeader(HttpHeaders.CACHE_CONTROL, "no-cache, no-store, must-revalidate");
    response.setHeader(HttpHeaders.PRAGMA, "no-cache");
    response.setDateHeader(HttpHeaders.EXPIRES, 0);
    response.setHeader(HttpHeaders.CONTENT_TYPE, "text/html; charset=utf-8");
    response.setStatus(200);
    response.getWriter().write(body);
}

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

/**
 * ?Header./*w w  w .  j  a  va  2  s. c om*/
 */
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.sobey.framework.utils.Servlets.java

/**
 * ?Header./*from w  w  w  .ja v a 2s.  c om*/
 */
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.cnksi.core.web.utils.Servlets.java

/**
 * ?Header.//  w  w w  . j av a  2 s.c om
 */
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.trc.core2.web.Servlets.java

/**
 * ?Header.//from  w w  w .ja v  a2s. c  om
 */
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.google.testing.security.firingrange.utils.Responses.java

/**
 * Sends an XSS response of a given type. 
 *//*  ww w .j  a  v a 2 s.  c  o m*/
public static void sendXssed(HttpServletResponse response, String body, String contentType) throws IOException {
    response.setHeader(HttpHeaders.X_XSS_PROTECTION, "0");
    response.setHeader(HttpHeaders.CACHE_CONTROL, "no-cache, no-store, must-revalidate");
    response.setHeader(HttpHeaders.PRAGMA, "no-cache");
    response.setDateHeader(HttpHeaders.EXPIRES, 0);
    response.setHeader(HttpHeaders.CONTENT_TYPE, contentType);
    response.setStatus(200);
    response.getWriter().write(body);
}

From source file:org.libreoffice.ci.gerrit.buildbot.servlets.QueueServlet.java

static void setNotCacheable(HttpServletResponse res) {
    res.setHeader(HttpHeaders.CACHE_CONTROL, "no-cache, no-store, max-age=0, must-revalidate");
    res.setHeader(HttpHeaders.PRAGMA, "no-cache");
    res.setHeader(HttpHeaders.EXPIRES, "Fri, 01 Jan 1990 00:00:00 GMT");
    res.setDateHeader(HttpHeaders.DATE, new Instant().getMillis());
}

From source file:org.haiku.haikudepotserver.pkg.controller.PkgIconController.java

/**
 * @param isAsFallback is true if the request was originally for a package, but fell back to this generic.
 *///from  w w  w  .ja v  a 2s.co  m

private void handleGenericHeadOrGet(RequestMethod requestMethod, HttpServletResponse response, Integer size,
        boolean isAsFallback) throws IOException {

    if (null == size) {
        size = 64; // largest natural size
    }

    size = normalizeSize(size);
    byte[] data = renderedPkgIconRepository.renderGeneric(size);
    response.setHeader(HttpHeaders.CONTENT_LENGTH, Integer.toString(data.length));
    response.setContentType(MediaType.PNG.toString());

    if (isAsFallback) {
        response.setHeader(HttpHeaders.CACHE_CONTROL, "no-cache, no-store, must-revalidate");
        response.setHeader(HttpHeaders.PRAGMA, "no-cache");
        response.setHeader(HttpHeaders.EXPIRES, "0");
    } else {
        response.setDateHeader(HttpHeaders.LAST_MODIFIED, startupMillis);
    }

    if (requestMethod == RequestMethod.GET) {
        response.getOutputStream().write(data);
    }
}