1// 2// ======================================================================== 3// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd. 4// ------------------------------------------------------------------------ 5// All rights reserved. This program and the accompanying materials 6// are made available under the terms of the Eclipse Public License v1.0 7// and Apache License v2.0 which accompanies this distribution. 8// 9// The Eclipse Public License is available at 10// http://www.eclipse.org/legal/epl-v10.html 11// 12// The Apache License v2.0 is available at 13// http://www.opensource.org/licenses/apache2.0.php 14// 15// You may elect to redistribute this code under either of these licenses. 16// ======================================================================== 17// 18 19package org.eclipse.jetty.http; 20 21import org.eclipse.jetty.io.Buffer; 22import org.eclipse.jetty.io.BufferCache; 23 24/* ------------------------------------------------------------------------------- */ 25/** 26 */ 27public class HttpHeaders extends BufferCache 28{ 29 /* ------------------------------------------------------------ */ 30 /** General Fields. 31 */ 32 public final static String 33 CONNECTION= "Connection", 34 CACHE_CONTROL= "Cache-Control", 35 DATE= "Date", 36 PRAGMA= "Pragma", 37 PROXY_CONNECTION = "Proxy-Connection", 38 TRAILER= "Trailer", 39 TRANSFER_ENCODING= "Transfer-Encoding", 40 UPGRADE= "Upgrade", 41 VIA= "Via", 42 WARNING= "Warning", 43 NEGOTIATE= "Negotiate"; 44 45 /* ------------------------------------------------------------ */ 46 /** Entity Fields. 47 */ 48 public final static String ALLOW= "Allow", 49 CONTENT_ENCODING= "Content-Encoding", 50 CONTENT_LANGUAGE= "Content-Language", 51 CONTENT_LENGTH= "Content-Length", 52 CONTENT_LOCATION= "Content-Location", 53 CONTENT_MD5= "Content-MD5", 54 CONTENT_RANGE= "Content-Range", 55 CONTENT_TYPE= "Content-Type", 56 EXPIRES= "Expires", 57 LAST_MODIFIED= "Last-Modified"; 58 59 /* ------------------------------------------------------------ */ 60 /** Request Fields. 61 */ 62 public final static String ACCEPT= "Accept", 63 ACCEPT_CHARSET= "Accept-Charset", 64 ACCEPT_ENCODING= "Accept-Encoding", 65 ACCEPT_LANGUAGE= "Accept-Language", 66 AUTHORIZATION= "Authorization", 67 EXPECT= "Expect", 68 FORWARDED= "Forwarded", 69 FROM= "From", 70 HOST= "Host", 71 IF_MATCH= "If-Match", 72 IF_MODIFIED_SINCE= "If-Modified-Since", 73 IF_NONE_MATCH= "If-None-Match", 74 IF_RANGE= "If-Range", 75 IF_UNMODIFIED_SINCE= "If-Unmodified-Since", 76 KEEP_ALIVE= "Keep-Alive", 77 MAX_FORWARDS= "Max-Forwards", 78 PROXY_AUTHORIZATION= "Proxy-Authorization", 79 RANGE= "Range", 80 REQUEST_RANGE= "Request-Range", 81 REFERER= "Referer", 82 TE= "TE", 83 USER_AGENT= "User-Agent", 84 X_FORWARDED_FOR= "X-Forwarded-For", 85 X_FORWARDED_PROTO= "X-Forwarded-Proto", 86 X_FORWARDED_SERVER= "X-Forwarded-Server", 87 X_FORWARDED_HOST= "X-Forwarded-Host"; 88 89 /* ------------------------------------------------------------ */ 90 /** Response Fields. 91 */ 92 public final static String ACCEPT_RANGES= "Accept-Ranges", 93 AGE= "Age", 94 ETAG= "ETag", 95 LOCATION= "Location", 96 PROXY_AUTHENTICATE= "Proxy-Authenticate", 97 RETRY_AFTER= "Retry-After", 98 SERVER= "Server", 99 SERVLET_ENGINE= "Servlet-Engine", 100 VARY= "Vary", 101 WWW_AUTHENTICATE= "WWW-Authenticate"; 102 103 /* ------------------------------------------------------------ */ 104 /** Other Fields. 105 */ 106 public final static String COOKIE= "Cookie", 107 SET_COOKIE= "Set-Cookie", 108 SET_COOKIE2= "Set-Cookie2", 109 MIME_VERSION= "MIME-Version", 110 IDENTITY= "identity"; 111 112 public final static int CONNECTION_ORDINAL= 1, 113 DATE_ORDINAL= 2, 114 PRAGMA_ORDINAL= 3, 115 TRAILER_ORDINAL= 4, 116 TRANSFER_ENCODING_ORDINAL= 5, 117 UPGRADE_ORDINAL= 6, 118 VIA_ORDINAL= 7, 119 WARNING_ORDINAL= 8, 120 ALLOW_ORDINAL= 9, 121 CONTENT_ENCODING_ORDINAL= 10, 122 CONTENT_LANGUAGE_ORDINAL= 11, 123 CONTENT_LENGTH_ORDINAL= 12, 124 CONTENT_LOCATION_ORDINAL= 13, 125 CONTENT_MD5_ORDINAL= 14, 126 CONTENT_RANGE_ORDINAL= 15, 127 CONTENT_TYPE_ORDINAL= 16, 128 EXPIRES_ORDINAL= 17, 129 LAST_MODIFIED_ORDINAL= 18, 130 ACCEPT_ORDINAL= 19, 131 ACCEPT_CHARSET_ORDINAL= 20, 132 ACCEPT_ENCODING_ORDINAL= 21, 133 ACCEPT_LANGUAGE_ORDINAL= 22, 134 AUTHORIZATION_ORDINAL= 23, 135 EXPECT_ORDINAL= 24, 136 FORWARDED_ORDINAL= 25, 137 FROM_ORDINAL= 26, 138 HOST_ORDINAL= 27, 139 IF_MATCH_ORDINAL= 28, 140 IF_MODIFIED_SINCE_ORDINAL= 29, 141 IF_NONE_MATCH_ORDINAL= 30, 142 IF_RANGE_ORDINAL= 31, 143 IF_UNMODIFIED_SINCE_ORDINAL= 32, 144 KEEP_ALIVE_ORDINAL= 33, 145 MAX_FORWARDS_ORDINAL= 34, 146 PROXY_AUTHORIZATION_ORDINAL= 35, 147 RANGE_ORDINAL= 36, 148 REQUEST_RANGE_ORDINAL= 37, 149 REFERER_ORDINAL= 38, 150 TE_ORDINAL= 39, 151 USER_AGENT_ORDINAL= 40, 152 X_FORWARDED_FOR_ORDINAL= 41, 153 ACCEPT_RANGES_ORDINAL= 42, 154 AGE_ORDINAL= 43, 155 ETAG_ORDINAL= 44, 156 LOCATION_ORDINAL= 45, 157 PROXY_AUTHENTICATE_ORDINAL= 46, 158 RETRY_AFTER_ORDINAL= 47, 159 SERVER_ORDINAL= 48, 160 SERVLET_ENGINE_ORDINAL= 49, 161 VARY_ORDINAL= 50, 162 WWW_AUTHENTICATE_ORDINAL= 51, 163 COOKIE_ORDINAL= 52, 164 SET_COOKIE_ORDINAL= 53, 165 SET_COOKIE2_ORDINAL= 54, 166 MIME_VERSION_ORDINAL= 55, 167 IDENTITY_ORDINAL= 56, 168 CACHE_CONTROL_ORDINAL=57, 169 PROXY_CONNECTION_ORDINAL=58, 170 X_FORWARDED_PROTO_ORDINAL=59, 171 X_FORWARDED_SERVER_ORDINAL=60, 172 X_FORWARDED_HOST_ORDINAL=61; 173 174 public final static HttpHeaders CACHE= new HttpHeaders(); 175 176 public final static Buffer 177 HOST_BUFFER=CACHE.add(HOST,HOST_ORDINAL), 178 ACCEPT_BUFFER=CACHE.add(ACCEPT,ACCEPT_ORDINAL), 179 ACCEPT_CHARSET_BUFFER=CACHE.add(ACCEPT_CHARSET,ACCEPT_CHARSET_ORDINAL), 180 ACCEPT_ENCODING_BUFFER=CACHE.add(ACCEPT_ENCODING,ACCEPT_ENCODING_ORDINAL), 181 ACCEPT_LANGUAGE_BUFFER=CACHE.add(ACCEPT_LANGUAGE,ACCEPT_LANGUAGE_ORDINAL), 182 183 CONTENT_LENGTH_BUFFER=CACHE.add(CONTENT_LENGTH,CONTENT_LENGTH_ORDINAL), 184 CONNECTION_BUFFER=CACHE.add(CONNECTION,CONNECTION_ORDINAL), 185 CACHE_CONTROL_BUFFER=CACHE.add(CACHE_CONTROL,CACHE_CONTROL_ORDINAL), 186 DATE_BUFFER=CACHE.add(DATE,DATE_ORDINAL), 187 PRAGMA_BUFFER=CACHE.add(PRAGMA,PRAGMA_ORDINAL), 188 TRAILER_BUFFER=CACHE.add(TRAILER,TRAILER_ORDINAL), 189 TRANSFER_ENCODING_BUFFER=CACHE.add(TRANSFER_ENCODING,TRANSFER_ENCODING_ORDINAL), 190 UPGRADE_BUFFER=CACHE.add(UPGRADE,UPGRADE_ORDINAL), 191 VIA_BUFFER=CACHE.add(VIA,VIA_ORDINAL), 192 WARNING_BUFFER=CACHE.add(WARNING,WARNING_ORDINAL), 193 ALLOW_BUFFER=CACHE.add(ALLOW,ALLOW_ORDINAL), 194 CONTENT_ENCODING_BUFFER=CACHE.add(CONTENT_ENCODING,CONTENT_ENCODING_ORDINAL), 195 CONTENT_LANGUAGE_BUFFER=CACHE.add(CONTENT_LANGUAGE,CONTENT_LANGUAGE_ORDINAL), 196 CONTENT_LOCATION_BUFFER=CACHE.add(CONTENT_LOCATION,CONTENT_LOCATION_ORDINAL), 197 CONTENT_MD5_BUFFER=CACHE.add(CONTENT_MD5,CONTENT_MD5_ORDINAL), 198 CONTENT_RANGE_BUFFER=CACHE.add(CONTENT_RANGE,CONTENT_RANGE_ORDINAL), 199 CONTENT_TYPE_BUFFER=CACHE.add(CONTENT_TYPE,CONTENT_TYPE_ORDINAL), 200 EXPIRES_BUFFER=CACHE.add(EXPIRES,EXPIRES_ORDINAL), 201 LAST_MODIFIED_BUFFER=CACHE.add(LAST_MODIFIED,LAST_MODIFIED_ORDINAL), 202 AUTHORIZATION_BUFFER=CACHE.add(AUTHORIZATION,AUTHORIZATION_ORDINAL), 203 EXPECT_BUFFER=CACHE.add(EXPECT,EXPECT_ORDINAL), 204 FORWARDED_BUFFER=CACHE.add(FORWARDED,FORWARDED_ORDINAL), 205 FROM_BUFFER=CACHE.add(FROM,FROM_ORDINAL), 206 IF_MATCH_BUFFER=CACHE.add(IF_MATCH,IF_MATCH_ORDINAL), 207 IF_MODIFIED_SINCE_BUFFER=CACHE.add(IF_MODIFIED_SINCE,IF_MODIFIED_SINCE_ORDINAL), 208 IF_NONE_MATCH_BUFFER=CACHE.add(IF_NONE_MATCH,IF_NONE_MATCH_ORDINAL), 209 IF_RANGE_BUFFER=CACHE.add(IF_RANGE,IF_RANGE_ORDINAL), 210 IF_UNMODIFIED_SINCE_BUFFER=CACHE.add(IF_UNMODIFIED_SINCE,IF_UNMODIFIED_SINCE_ORDINAL), 211 KEEP_ALIVE_BUFFER=CACHE.add(KEEP_ALIVE,KEEP_ALIVE_ORDINAL), 212 MAX_FORWARDS_BUFFER=CACHE.add(MAX_FORWARDS,MAX_FORWARDS_ORDINAL), 213 PROXY_AUTHORIZATION_BUFFER=CACHE.add(PROXY_AUTHORIZATION,PROXY_AUTHORIZATION_ORDINAL), 214 RANGE_BUFFER=CACHE.add(RANGE,RANGE_ORDINAL), 215 REQUEST_RANGE_BUFFER=CACHE.add(REQUEST_RANGE,REQUEST_RANGE_ORDINAL), 216 REFERER_BUFFER=CACHE.add(REFERER,REFERER_ORDINAL), 217 TE_BUFFER=CACHE.add(TE,TE_ORDINAL), 218 USER_AGENT_BUFFER=CACHE.add(USER_AGENT,USER_AGENT_ORDINAL), 219 X_FORWARDED_FOR_BUFFER=CACHE.add(X_FORWARDED_FOR,X_FORWARDED_FOR_ORDINAL), 220 X_FORWARDED_PROTO_BUFFER=CACHE.add(X_FORWARDED_PROTO,X_FORWARDED_PROTO_ORDINAL), 221 X_FORWARDED_SERVER_BUFFER=CACHE.add(X_FORWARDED_SERVER,X_FORWARDED_SERVER_ORDINAL), 222 X_FORWARDED_HOST_BUFFER=CACHE.add(X_FORWARDED_HOST,X_FORWARDED_HOST_ORDINAL), 223 ACCEPT_RANGES_BUFFER=CACHE.add(ACCEPT_RANGES,ACCEPT_RANGES_ORDINAL), 224 AGE_BUFFER=CACHE.add(AGE,AGE_ORDINAL), 225 ETAG_BUFFER=CACHE.add(ETAG,ETAG_ORDINAL), 226 LOCATION_BUFFER=CACHE.add(LOCATION,LOCATION_ORDINAL), 227 PROXY_AUTHENTICATE_BUFFER=CACHE.add(PROXY_AUTHENTICATE,PROXY_AUTHENTICATE_ORDINAL), 228 RETRY_AFTER_BUFFER=CACHE.add(RETRY_AFTER,RETRY_AFTER_ORDINAL), 229 SERVER_BUFFER=CACHE.add(SERVER,SERVER_ORDINAL), 230 SERVLET_ENGINE_BUFFER=CACHE.add(SERVLET_ENGINE,SERVLET_ENGINE_ORDINAL), 231 VARY_BUFFER=CACHE.add(VARY,VARY_ORDINAL), 232 WWW_AUTHENTICATE_BUFFER=CACHE.add(WWW_AUTHENTICATE,WWW_AUTHENTICATE_ORDINAL), 233 COOKIE_BUFFER=CACHE.add(COOKIE,COOKIE_ORDINAL), 234 SET_COOKIE_BUFFER=CACHE.add(SET_COOKIE,SET_COOKIE_ORDINAL), 235 SET_COOKIE2_BUFFER=CACHE.add(SET_COOKIE2,SET_COOKIE2_ORDINAL), 236 MIME_VERSION_BUFFER=CACHE.add(MIME_VERSION,MIME_VERSION_ORDINAL), 237 IDENTITY_BUFFER=CACHE.add(IDENTITY,IDENTITY_ORDINAL), 238 PROXY_CONNECTION_BUFFER=CACHE.add(PROXY_CONNECTION,PROXY_CONNECTION_ORDINAL); 239 240 241} 242