    001    /*
    002     * Copyright (C) 2011 The Guava Authors
    003     *
    004     * Licensed under the Apache License, Version 2.0 (the "License");
    005     * you may not use this file except in compliance with the License.
    006     * You may obtain a copy of the License at
    007     *
    008     * http://www.apache.org/licenses/LICENSE-2.0
    009     *
    010     * Unless required by applicable law or agreed to in writing, software
    011     * distributed under the License is distributed on an "AS IS" BASIS,
    012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    013     * See the License for the specific language governing permissions and
    014     * limitations under the License.
    015     */
    016
    017    package com.google.common.net;
    018
    019    import com.google.common.annotations.Beta;
    020    import com.google.common.annotations.GwtCompatible;
    021
    022    /**
    023     * Contains constant definitions for the HTTP header field names. See:
    024     * <ul>
    025     * <li><a href="http://www.ietf.org/rfc/rfc2109.txt">RFC 2109</a>
    026     * <li><a href="http://www.ietf.org/rfc/rfc2183.txt">RFC 2183</a>
    027     * <li><a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a>
    028     * <li><a href="http://www.ietf.org/rfc/rfc2965.txt">RFC 2965</a>
    029     * <li><a href="http://www.ietf.org/rfc/rfc5988.txt">RFC 5988</a>
    030     * </ul>
    031     *
    032     * @author Kurt Alfred Kluever
    033     * @since 11.0
    034     */
    035    @Beta
    036    @GwtCompatible
    037    public final class HttpHeaders {
    038      private HttpHeaders() {}
    039
    040      // HTTP Request and Response header fields
    041
    042      /** The HTTP Cache-Control header field name. */
    043      public static final String CACHE_CONTROL = "Cache-Control";
    044      /** The HTTP Content-Length header field name. */
    045      public static final String CONTENT_LENGTH = "Content-Length";
    046      /** The HTTP Content-Type header field name. */
    047      public static final String CONTENT_TYPE = "Content-Type";
    048      /** The HTTP Date header field name. */
    049      public static final String DATE = "Date";
    050      /** The HTTP Pragma header field name. */
    051      public static final String PRAGMA = "Pragma";
    052      /** The HTTP Via header field name. */
    053      public static final String VIA = "Via";
    054      /** The HTTP Warning header field name. */
    055      public static final String WARNING = "Warning";
    056
    057      // HTTP Request header fields
    058
    059      /** The HTTP Accept header field name. */
    060      public static final String ACCEPT = "Accept";
    061      /** The HTTP Accept-Charset header field name. */
    062      public static final String ACCEPT_CHARSET = "Accept-Charset";
    063      /** The HTTP Accept-Encoding header field name. */
    064      public static final String ACCEPT_ENCODING = "Accept-Encoding";
    065      /** The HTTP Accept-Language header field name. */
    066      public static final String ACCEPT_LANGUAGE = "Accept-Language";
    067      /** The HTTP Access-Control-Request-Headers header field name. */
    068      public static final String ACCESS_CONTROL_REQUEST_HEADERS = "Access-Control-Request-Headers";
    069      /** The HTTP Access-Control-Request-Method header field name. */
    070      public static final String ACCESS_CONTROL_REQUEST_METHOD = "Access-Control-Request-Method";
    071      /** The HTTP Authorization header field name. */
    072      public static final String AUTHORIZATION = "Authorization";
    073      /** The HTTP Connection header field name. */
    074      public static final String CONNECTION = "Connection";
    075      /** The HTTP Cookie header field name. */
    076      public static final String COOKIE = "Cookie";
    077      /** The HTTP Expect header field name. */
    078      public static final String EXPECT = "Expect";
    079      /** The HTTP From header field name. */
    080      public static final String FROM = "From";
    081      /** The HTTP Host header field name. */
    082      public static final String HOST = "Host";
    083      /** The HTTP If-Match header field name. */
    084      public static final String IF_MATCH = "If-Match";
    085      /** The HTTP If-Modified-Since header field name. */
    086      public static final String IF_MODIFIED_SINCE = "If-Modified-Since";
    087      /** The HTTP If-None-Match header field name. */
    088      public static final String IF_NONE_MATCH = "If-None-Match";
    089      /** The HTTP If-Range header field name. */
    090      public static final String IF_RANGE = "If-Range";
    091      /** The HTTP If-Unmodified-Since header field name. */
    092      public static final String IF_UNMODIFIED_SINCE = "If-Unmodified-Since";
    093      /** The HTTP Last-Event-ID header field name. */
    094      public static final String LAST_EVENT_ID = "Last-Event-ID";
    095      /** The HTTP Max-Forwards header field name. */
    096      public static final String MAX_FORWARDS = "Max-Forwards";
    097      /** The HTTP Origin header field name. */
    098      public static final String ORIGIN = "Origin";
    099      /** The HTTP Proxy-Authorization header field name. */
    100      public static final String PROXY_AUTHORIZATION = "Proxy-Authorization";
    101      /** The HTTP Range header field name. */
    102      public static final String RANGE = "Range";
    103      /** The HTTP Referer header field name. */
    104      public static final String REFERER = "Referer";
    105      /** The HTTP TE header field name. */
    106      public static final String TE = "TE";
    107      /** The HTTP Upgrade header field name. */
    108      public static final String UPGRADE = "Upgrade";
    109      /** The HTTP User-Agent header field name. */
    110      public static final String USER_AGENT = "User-Agent";
    111
    112      // HTTP Response header fields
    113
    114      /** The HTTP Accept-Ranges header field name. */
    115      public static final String ACCEPT_RANGES = "Accept-Ranges";
    116      /** The HTTP Access-Control-Allow-Headers header field name. */
    117      public static final String ACCESS_CONTROL_ALLOW_HEADERS = "Access-Control-Allow-Headers";
    118      /** The HTTP Access-Control-Allow-Methods header field name. */
    119      public static final String ACCESS_CONTROL_ALLOW_METHODS = "Access-Control-Allow-Methods";
    120      /** The HTTP Access-Control-Allow-Origin header field name. */
    121      public static final String ACCESS_CONTROL_ALLOW_ORIGIN = "Access-Control-Allow-Origin";
    122      /** The HTTP Access-Control-Allow-Credentials header field name. */
    123      public static final String ACCESS_CONTROL_ALLOW_CREDENTIALS = "Access-Control-Allow-Credentials";
    124      /** The HTTP Access-Control-Expose-Headers header field name. */
    125      public static final String ACCESS_CONTROL_EXPOSE_HEADERS = "Access-Control-Expose-Headers";
    126      /** The HTTP Access-Control-Max-Age header field name. */
    127      public static final String ACCESS_CONTROL_MAX_AGE = "Access-Control-Max-Age";
    128      /** The HTTP Age header field name. */
    129      public static final String AGE = "Age";
    130      /** The HTTP Allow header field name. */
    131      public static final String ALLOW = "Allow";
    132      /** The HTTP Content-Disposition header field name. */
    133      public static final String CONTENT_DISPOSITION = "Content-Disposition";
    134      /** The HTTP Content-Encoding header field name. */
    135      public static final String CONTENT_ENCODING = "Content-Encoding";
    136      /** The HTTP Content-Language header field name. */
    137      public static final String CONTENT_LANGUAGE = "Content-Language";
    138      /** The HTTP Content-Location header field name. */
    139      public static final String CONTENT_LOCATION = "Content-Location";
    140      /** The HTTP Content-MD5 header field name. */
    141      public static final String CONTENT_MD5 = "Content-MD5";
    142      /** The HTTP Content-Range header field name. */
    143      public static final String CONTENT_RANGE = "Content-Range";
    144      /** The HTTP ETag header field name. */
    145      public static final String ETAG = "ETag";
    146      /** The HTTP Expires header field name. */
    147      public static final String EXPIRES = "Expires";
    148      /** The HTTP Last-Modified header field name. */
    149      public static final String LAST_MODIFIED = "Last-Modified";
    150      /** The HTTP Link header field name. */
    151      public static final String LINK = "Link";
    152      /** The HTTP Location header field name. */
    153      public static final String LOCATION = "Location";
    154      /** The HTTP P3P header field name. Limited browser support. */
    155      public static final String P3P = "P3P";
    156      /** The HTTP Proxy-Authenticate header field name. */
    157      public static final String PROXY_AUTHENTICATE = "Proxy-Authenticate";
    158      /** The HTTP Refresh header field name. Non-standard header supported by most browsers. */
    159      public static final String REFRESH = "Refresh";
    160      /** The HTTP Retry-After header field name. */
    161      public static final String RETRY_AFTER = "Retry-After";
    162      /** The HTTP Server header field name. */
    163      public static final String SERVER = "Server";
    164      /** The HTTP Set-Cookie header field name. */
    165      public static final String SET_COOKIE = "Set-Cookie";
    166      /** The HTTP Set-Cookie2 header field name. */
    167      public static final String SET_COOKIE2 = "Set-Cookie2";
    168      /** The HTTP Trailer header field name. */
    169      public static final String TRAILER = "Trailer";
    170      /** The HTTP Transfer-Encoding header field name. */
    171      public static final String TRANSFER_ENCODING = "Transfer-Encoding";
    172      /** The HTTP Vary header field name. */
    173      public static final String VARY = "Vary";
    174      /** The HTTP WWW-Authenticate header field name. */
    175      public static final String WWW_AUTHENTICATE = "WWW-Authenticate";
    176
    177      // Common, non-standard HTTP header fields
    178
    179      /** The HTTP DNT header field name. */
    180      public static final String DNT = "DNT";
    181      /** The HTTP X-Content-Type-Options header field name. */
    182      public static final String X_CONTENT_TYPE_OPTIONS = "X-Content-Type-Options";
    183      /** The HTTP X-Do-Not-Track header field name. */
    184      public static final String X_DO_NOT_TRACK = "X-Do-Not-Track";
    185      /** The HTTP X-Forwarded-For header field name. */
    186      public static final String X_FORWARDED_FOR = "X-Forwarded-For";
    187      /** The HTTP X-Forwarded-Proto header field name. */
    188      public static final String X_FORWARDED_PROTO = "X-Forwarded-Proto";
    189      /** The HTTP X-Frame-Options header field name. */
    190      public static final String X_FRAME_OPTIONS = "X-Frame-Options";
    191      /** The HTTP X-Powered-By header field name. */
    192      public static final String X_POWERED_BY = "X-Powered-By";
    193      /** The HTTP X-Requested-With header field name. */
    194      public static final String X_REQUESTED_WITH = "X-Requested-With";
    195      /** The HTTP X-User-IP header field name. */
    196      public static final String X_USER_IP = "X-User-IP";
    197      /** The HTTP X-XSS-Protection header field name. */
    198      public static final String X_XSS_PROTECTION = "X-XSS-Protection";
    199
    200    }