Example usage for org.eclipse.jgit.util HttpSupport HDR_ETAG

List of usage examples for org.eclipse.jgit.util HttpSupport HDR_ETAG

Introduction

In this page you can find the example usage for org.eclipse.jgit.util HttpSupport HDR_ETAG.

Prototype

String HDR_ETAG

To view the source code for org.eclipse.jgit.util HttpSupport HDR_ETAG.

Click Source Link

Document

The ETag header.

Usage

From source file:org.webcat.core.http.RequestUtils.java

License:Open Source License

/**
 * Prepares a byte array to be appended to a response, by compressing it
 * (if the request supports that) as well as setting its etag header.
 *
 * @param content the raw content to send
 * @param request the request//from  w  w w .j a va 2 s. c om
 * @param response the response
 * @return the byte array that should be sent (which may be a compressed
 *     version of the one sent in)
 * @throws IOException if an I/O error occurs
 */
private static byte[] preSend(byte[] content, WORequest request, WOResponse response) throws IOException {
    response.setHeader(etag(content), HttpSupport.HDR_ETAG);

    if (content.length > 256 && acceptsGZIPEncoding(request)) {
        content = compressBytes(content);
        response.setHeader(HttpSupport.ENCODING_GZIP, HttpSupport.HDR_CONTENT_ENCODING);
    }

    return content;
}