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

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

Introduction

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

Prototype

String IF_RANGE

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

Click Source Link

Document

The HTTP If-Range header field name.

Usage

From source file:org.eclipse.hawkbit.rest.util.RestResourceConversionHelper.java

private static void checkForShortcut(final HttpServletRequest request, final String etag,
        final long lastModified, final ByteRange full, final List<ByteRange> ranges) {
    final String ifRange = request.getHeader(HttpHeaders.IF_RANGE);
    if (ifRange != null && !ifRange.equals(etag)) {
        try {//from w  w  w  .j a  v  a2s  .co m
            final long ifRangeTime = request.getDateHeader(HttpHeaders.IF_RANGE);
            if (ifRangeTime != -1 && ifRangeTime + 1000 < lastModified) {
                ranges.add(full);
            }
        } catch (final IllegalArgumentException ignore) {
            LOG.info("Invalid if-range header field", ignore);
            ranges.add(full);
        }
    }
}