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

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

Introduction

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

Prototype

String IF_UNMODIFIED_SINCE

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

Click Source Link

Document

The HTTP If-Unmodified-Since header field name.

Usage

From source file:org.jclouds.openstack.swift.v1.options.CopyOptions.java

public CopyOptions ifUnmodifiedSince(Date ifUnmodifiedSince) {
    this.headers.put(HttpHeaders.IF_UNMODIFIED_SINCE, dateService.rfc822DateFormat(ifUnmodifiedSince));
    return this;
}

From source file:org.sonatype.nexus.repository.http.HttpConditions.java

@Nullable
private static Predicate<Response> ifUnmodifiedSince(final Request request) {
    final DateTime date = parseDateHeader(request.getHeaders().get(HttpHeaders.IF_UNMODIFIED_SINCE));
    if (date != null) {
        return new Predicate<Response>() {
            @Override//from  w  ww. ja  v  a 2s.  com
            public boolean apply(final Response response) {
                final DateTime lastModified = parseDateHeader(
                        response.getHeaders().get(HttpHeaders.LAST_MODIFIED));
                if (lastModified != null) {
                    return !lastModified.isAfter(date);
                }
                return true;
            }

            @Override
            public String toString() {
                return HttpConditions.class.getSimpleName() + ".ifUnmodifiedSince(" + date + ")";
            }
        };
    }
    return null;
}