001: /*
002: * Copyright 2005-2007 Noelios Consulting.
003: *
004: * The contents of this file are subject to the terms of the Common Development
005: * and Distribution License (the "License"). You may not use this file except in
006: * compliance with the License.
007: *
008: * You can obtain a copy of the license at
009: * http://www.opensource.org/licenses/cddl1.txt See the License for the specific
010: * language governing permissions and limitations under the License.
011: *
012: * When distributing Covered Code, include this CDDL HEADER in each file and
013: * include the License file at http://www.opensource.org/licenses/cddl1.txt If
014: * applicable, add the following below this CDDL HEADER, with the fields
015: * enclosed by brackets "[]" replaced with your own identifying information:
016: * Portions Copyright [yyyy] [name of copyright owner]
017: */
018:
019: package com.noelios.restlet.http;
020:
021: /**
022: * Constants related to the HTTP protocol.
023: *
024: * @author Jerome Louvel (contact@noelios.com)
025: */
026: public final class HttpConstants {
027: // ---------------------
028: // --- Status codes ---
029: // ---------------------
030:
031: public static final int STATUS_INFO_CONTINUE = 100;
032:
033: public static final int STATUS_INFO_SWITCHING_PROTOCOL = 101;
034:
035: public static final int STATUS_INFO_PROCESSING = 102;
036:
037: public static final int STATUS_SUCCESS_OK = 200;
038:
039: public static final int STATUS_SUCCESS_CREATED = 201;
040:
041: public static final int STATUS_SUCCESS_ACCEPTED = 202;
042:
043: public static final int STATUS_SUCCESS_NON_AUTHORITATIVE = 203;
044:
045: public static final int STATUS_SUCCESS_NO_CONTENT = 204;
046:
047: public static final int STATUS_SUCCESS_RESET_CONTENT = 205;
048:
049: public static final int STATUS_SUCCESS_PARTIAL_CONTENT = 206;
050:
051: public static final int STATUS_SUCCESS_MULTI_STATUS = 207;
052:
053: public static final int STATUS_REDIRECTION_MULTIPLE_CHOICES = 300;
054:
055: public static final int STATUS_REDIRECTION_MOVED_PERMANENTLY = 301;
056:
057: public static final int STATUS_REDIRECTION_FOUND = 302;
058:
059: public static final int STATUS_REDIRECTION_SEE_OTHER = 303;
060:
061: public static final int STATUS_REDIRECTION_NOT_MODIFIED = 304;
062:
063: public static final int STATUS_REDIRECTION_USE_PROXY = 305;
064:
065: public static final int STATUS_REDIRECTION_MOVED_TEMPORARILY = 307;
066:
067: public static final int STATUS_CLIENT_ERROR_BAD_REQUEST = 400;
068:
069: public static final int STATUS_CLIENT_ERROR_UNAUTHORIZED = 401;
070:
071: public static final int STATUS_CLIENT_ERROR_PAYMENT_REQUIRED = 402;
072:
073: public static final int STATUS_CLIENT_ERROR_FORBIDDEN = 403;
074:
075: public static final int STATUS_CLIENT_ERROR_NOT_FOUND = 404;
076:
077: public static final int STATUS_CLIENT_ERROR_METHOD_NOT_ALLOWED = 405;
078:
079: public static final int STATUS_CLIENT_ERROR_NOT_ACCEPTABLE = 406;
080:
081: public static final int STATUS_CLIENT_ERROR_PROXY_AUTHENTIFICATION_REQUIRED = 407;
082:
083: public static final int STATUS_CLIENT_ERROR_REQUEST_TIMEOUT = 408;
084:
085: public static final int STATUS_CLIENT_ERROR_CONFLICT = 409;
086:
087: public static final int STATUS_CLIENT_ERROR_GONE = 410;
088:
089: public static final int STATUS_CLIENT_ERROR_LENGTH_REQUIRED = 411;
090:
091: public static final int STATUS_CLIENT_ERROR_PRECONDITION_FAILED = 412;
092:
093: public static final int STATUS_CLIENT_ERROR_REQUEST_ENTITY_TOO_LARGE = 413;
094:
095: public static final int STATUS_CLIENT_ERROR_REQUEST_URI_TOO_LONG = 414;
096:
097: public static final int STATUS_CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE = 415;
098:
099: public static final int STATUS_CLIENT_ERROR_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
100:
101: public static final int STATUS_CLIENT_ERROR_EXPECTATION_FAILED = 417;
102:
103: public static final int STATUS_CLIENT_ERROR_UNPROCESSABLE_ENTITY = 422;
104:
105: public static final int STATUS_CLIENT_ERROR_LOCKED = 423;
106:
107: public static final int STATUS_CLIENT_ERROR_FAILED_DEPENDENCY = 424;
108:
109: public static final int STATUS_SERVER_ERROR_INTERNAL = 500;
110:
111: public static final int STATUS_SERVER_ERROR_NOT_IMPLEMENTED = 501;
112:
113: public static final int STATUS_SERVER_ERROR_BAD_GATEWAY = 502;
114:
115: public static final int STATUS_SERVER_ERROR_SERVICE_UNAVAILABLE = 503;
116:
117: public static final int STATUS_SERVER_ERROR_GATEWAY_TIMEOUT = 504;
118:
119: public static final int STATUS_SERVER_ERROR_HTTP_VERSION_NOT_SUPPORTED = 505;
120:
121: public static final int STATUS_SERVER_ERROR_INSUFFICIENT_STORAGE = 507;
122:
123: // ---------------------
124: // --- Header names ---
125: // ---------------------
126:
127: public static final String HEADER_ACCEPT = "Accept";
128:
129: public static final String HEADER_ACCEPT_CHARSET = "Accept-Charset";
130:
131: public static final String HEADER_ACCEPT_ENCODING = "Accept-Encoding";
132:
133: public static final String HEADER_ACCEPT_LANGUAGE = "Accept-Language";
134:
135: public static final String HEADER_ACCEPT_RANGES = "Accept-Ranges";
136:
137: public static final String HEADER_AGE = "Age";
138:
139: public static final String HEADER_ALLOW = "Allow";
140:
141: public static final String HEADER_AUTHORIZATION = "Authorization";
142:
143: public static final String HEADER_CACHE_CONTROL = "Cache-Control";
144:
145: public static final String HEADER_CONNECTION = "Connection";
146:
147: public static final String HEADER_CONTENT_ENCODING = "Content-Encoding";
148:
149: public static final String HEADER_CONTENT_LANGUAGE = "Content-Language";
150:
151: public static final String HEADER_CONTENT_LENGTH = "Content-Length";
152:
153: public static final String HEADER_CONTENT_LOCATION = "Content-Location";
154:
155: public static final String HEADER_CONTENT_MD5 = "Content-MD5";
156:
157: public static final String HEADER_CONTENT_RANGE = "Content-Range";
158:
159: public static final String HEADER_CONTENT_TYPE = "Content-Type";
160:
161: public static final String HEADER_COOKIE = "Cookie";
162:
163: public static final String HEADER_DATE = "Date";
164:
165: public static final String HEADER_ETAG = "ETag";
166:
167: public static final String HEADER_EXPECT = "Expect";
168:
169: public static final String HEADER_EXPIRES = "Expires";
170:
171: public static final String HEADER_FROM = "From";
172:
173: public static final String HEADER_HOST = "Host";
174:
175: public static final String HEADER_IF_MATCH = "If-Match";
176:
177: public static final String HEADER_IF_MODIFIED_SINCE = "If-Modified-Since";
178:
179: public static final String HEADER_IF_NONE_MATCH = "If-None-Match";
180:
181: public static final String HEADER_IF_RANGE = "If-Range";
182:
183: public static final String HEADER_IF_UNMODIFIED_SINCE = "If-Unmodified-Since";
184:
185: public static final String HEADER_LAST_MODIFIED = "Last-Modified";
186:
187: public static final String HEADER_LOCATION = "Location";
188:
189: public static final String HEADER_MAX_FORWARDS = "Max-Forwards";
190:
191: public static final String HEADER_PRAGMA = "Pragma";
192:
193: public static final String HEADER_PROXY_AUTHENTICATE = "Proxy-Authenticate";
194:
195: public static final String HEADER_PROXY_AUTHORIZATION = "Proxy-Authorization";
196:
197: public static final String HEADER_RANGE = "Range";
198:
199: public static final String HEADER_REFERRER = "Referer";
200:
201: public static final String HEADER_RETRY_AFTER = "Retry-After";
202:
203: public static final String HEADER_SERVER = "Server";
204:
205: public static final String HEADER_SET_COOKIE = "Set-Cookie";
206:
207: public static final String HEADER_SET_COOKIE2 = "Set-Cookie2";
208:
209: public static final String HEADER_TRAILER = "Trailer";
210:
211: public static final String HEADER_TRANSFER_ENCODING = "Transfer-Encoding";
212:
213: public static final String HEADER_TRANSFER_EXTENSION = "TE";
214:
215: public static final String HEADER_UPGRADE = "Upgrade";
216:
217: public static final String HEADER_USER_AGENT = "User-Agent";
218:
219: public static final String HEADER_VARY = "Vary";
220:
221: public static final String HEADER_VIA = "Via";
222:
223: public static final String HEADER_WARNING = "Warning";
224:
225: public static final String HEADER_WWW_AUTHENTICATE = "WWW-Authenticate";
226:
227: public static final String HEADER_X_FORWARDED_FOR = "X-Forwarded-For";
228:
229: public static final String HEADER_X_HTTP_METHOD_OVERRIDE = "X-HTTP-Method-Override";
230:
231: // -------------------------
232: // --- Attribute names ---
233: // -------------------------
234:
235: public static final String ATTRIBUTE_HEADERS = "org.restlet.http.headers";
236:
237: public static final String ATTRIBUTE_VERSION = "org.restlet.http.version";
238: }
|