View Javadoc
1   /*
2    * ====================================================================
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   * ====================================================================
20   *
21   * This software consists of voluntary contributions made by many
22   * individuals on behalf of the Apache Software Foundation.  For more
23   * information on the Apache Software Foundation, please see
24   * <http://www.apache.org/>.
25   *
26   */
27  
28  package org.apache.hc.core5.http;
29  
30  /**
31   * Constants enumerating the HTTP status codes.
32   * All status codes defined in RFC1945 (HTTP/1.0), RFC2616 (HTTP/1.1),
33   * RFC2518 (WebDAV), RFC7540 (HTTP/2), RFC6585 (Additional HTTP Status Codes)
34   * RFC8297 (Early Hints), RFC7538 (Permanent Redirect), RFC7725 (An HTTP Status
35   * Code to Report Legal Obstacles) and RFC2295 (Transparent Content Negotiation)
36   * are listed.
37   *
38   * @see <a href="https://tools.ietf.org/html/rfc1945">RFC1945 (HTTP/1.0)</a>
39   * @see <a href="https://tools.ietf.org/html/rfc2616">RFC2616 (HTTP/1.1)</a>
40   * @see <a href="https://tools.ietf.org/html/rfc2518">RFC2518 (WebDAV)</a>
41   * @see <a href="https://tools.ietf.org/html/rfc7540">RFC7540 (HTTP/2)</a>
42   * @see <a href="https://tools.ietf.org/html/rfc6585">RFC6585 (Additional HTTP Status Codes)</a>
43   * @see <a href="https://tools.ietf.org/html/rfc8297">RFC8297 (Early Hints)</a>
44   * @see <a href="https://tools.ietf.org/html/rfc7538">RFC7538 (Permanent Redirect)</a>
45   * @see <a href="https://tools.ietf.org/html/rfc7725">RFC7725 (An HTTP Status Code to Report Legal Obstacles)</a>
46   * @see <a href="https://tools.ietf.org/html/rfc2295">RFC2295 (Transparent Content Negotiation)</a>
47   * @since 4.0
48   */
49  public interface HttpStatus {
50  
51      // --- 1xx Informational ---
52      /** {@code 100 1xx Informational} (HTTP/1.1 - RFC 2616) */
53      int SC_INFORMATIONAL = 100;
54  
55      /** {@code 100 Continue} (HTTP/1.1 - RFC 2616) */
56      int SC_CONTINUE = 100;
57      /** {@code 101 Switching Protocols} (HTTP/1.1 - RFC 2616)*/
58      int SC_SWITCHING_PROTOCOLS = 101;
59      /** {@code 102 Processing} (WebDAV - RFC 2518) */
60      int SC_PROCESSING = 102;
61      /** {@code 103 Early Hints (Early Hints - RFC 8297)}*/
62      int SC_EARLY_HINTS = 103;
63  
64      // --- 2xx Success ---
65      /** {@code 2xx Success} (HTTP/1.0 - RFC 1945) */
66      int SC_SUCCESS = 200;
67  
68      /** {@code 200 OK} (HTTP/1.0 - RFC 1945) */
69      int SC_OK = 200;
70      /** {@code 201 Created} (HTTP/1.0 - RFC 1945) */
71      int SC_CREATED = 201;
72      /** {@code 202 Accepted} (HTTP/1.0 - RFC 1945) */
73      int SC_ACCEPTED = 202;
74      /** {@code 203 Non Authoritative Information} (HTTP/1.1 - RFC 2616) */
75      int SC_NON_AUTHORITATIVE_INFORMATION = 203;
76      /** {@code 204 No Content} (HTTP/1.0 - RFC 1945) */
77      int SC_NO_CONTENT = 204;
78      /** {@code 205 Reset Content} (HTTP/1.1 - RFC 2616) */
79      int SC_RESET_CONTENT = 205;
80      /** {@code 206 Partial Content} (HTTP/1.1 - RFC 2616) */
81      int SC_PARTIAL_CONTENT = 206;
82      /**
83       * {@code 207 Multi-Status} (WebDAV - RFC 2518)
84       * or
85       * {@code 207 Partial Update OK} (HTTP/1.1 - draft-ietf-http-v11-spec-rev-01?)
86       */
87      int SC_MULTI_STATUS = 207;
88      /**
89       * {@code 208 Already Reported} (WebDAV - RFC 5842, p.30, section 7.1)
90       */
91      int SC_ALREADY_REPORTED = 208;
92      /**
93       * {@code 226 IM Used} (Delta encoding in HTTP - RFC 3229, p. 30, section 10.4.1)
94       */
95      int SC_IM_USED = 226;
96  
97      // --- 3xx Redirection ---
98      /** {@code 3xx Redirection} (HTTP/1.1 - RFC 2616) */
99      int SC_REDIRECTION = 300;
100 
101     /** {@code 300 Mutliple Choices} (HTTP/1.1 - RFC 2616) */
102     int SC_MULTIPLE_CHOICES = 300;
103     /** {@code 301 Moved Permanently} (HTTP/1.0 - RFC 1945) */
104     int SC_MOVED_PERMANENTLY = 301;
105     /** {@code 302 Moved Temporarily} (Sometimes {@code Found}) (HTTP/1.0 - RFC 1945) */
106     int SC_MOVED_TEMPORARILY = 302;
107     /** {@code 303 See Other} (HTTP/1.1 - RFC 2616) */
108     int SC_SEE_OTHER = 303;
109     /** {@code 304 Not Modified} (HTTP/1.0 - RFC 1945) */
110     int SC_NOT_MODIFIED = 304;
111     /** {@code 305 Use Proxy} (HTTP/1.1 - RFC 2616) */
112     int SC_USE_PROXY = 305;
113     /** {@code 307 Temporary Redirect} (HTTP/1.1 - RFC 2616) */
114     int SC_TEMPORARY_REDIRECT = 307;
115 
116     /** {@code 308 Permanent Redirect} (HTTP/1.1 - RFC 7538) */
117     int SC_PERMANENT_REDIRECT = 308;
118 
119     // --- 4xx Client Error ---
120     /** {@code 4xx Client Error} (HTTP/1.1 - RFC 2616) */
121     int SC_CLIENT_ERROR = 400;
122 
123     /** {@code 400 Bad Request} (HTTP/1.1 - RFC 2616) */
124     int SC_BAD_REQUEST = 400;
125     /** {@code 401 Unauthorized} (HTTP/1.0 - RFC 1945) */
126     int SC_UNAUTHORIZED = 401;
127     /** {@code 402 Payment Required} (HTTP/1.1 - RFC 2616) */
128     int SC_PAYMENT_REQUIRED = 402;
129     /** {@code 403 Forbidden} (HTTP/1.0 - RFC 1945) */
130     int SC_FORBIDDEN = 403;
131     /** {@code 404 Not Found} (HTTP/1.0 - RFC 1945) */
132     int SC_NOT_FOUND = 404;
133     /** {@code 405 Method Not Allowed} (HTTP/1.1 - RFC 2616) */
134     int SC_METHOD_NOT_ALLOWED = 405;
135     /** {@code 406 Not Acceptable} (HTTP/1.1 - RFC 2616) */
136     int SC_NOT_ACCEPTABLE = 406;
137     /** {@code 407 Proxy Authentication Required} (HTTP/1.1 - RFC 2616)*/
138     int SC_PROXY_AUTHENTICATION_REQUIRED = 407;
139     /** {@code 408 Request Timeout} (HTTP/1.1 - RFC 2616) */
140     int SC_REQUEST_TIMEOUT = 408;
141     /** {@code 409 Conflict} (HTTP/1.1 - RFC 2616) */
142     int SC_CONFLICT = 409;
143     /** {@code 410 Gone} (HTTP/1.1 - RFC 2616) */
144     int SC_GONE = 410;
145     /** {@code 411 Length Required} (HTTP/1.1 - RFC 2616) */
146     int SC_LENGTH_REQUIRED = 411;
147     /** {@code 412 Precondition Failed} (HTTP/1.1 - RFC 2616) */
148     int SC_PRECONDITION_FAILED = 412;
149     /** {@code 413 Request Entity Too Large} (HTTP/1.1 - RFC 2616) */
150     int SC_REQUEST_TOO_LONG = 413;
151     /** {@code 414 Request-URI Too Long} (HTTP/1.1 - RFC 2616) */
152     int SC_REQUEST_URI_TOO_LONG = 414;
153     /** {@code 415 Unsupported Media Type} (HTTP/1.1 - RFC 2616) */
154     int SC_UNSUPPORTED_MEDIA_TYPE = 415;
155     /** {@code 416 Requested Range Not Satisfiable} (HTTP/1.1 - RFC 2616) */
156     int SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
157     /** {@code 417 Expectation Failed} (HTTP/1.1 - RFC 2616) */
158     int SC_EXPECTATION_FAILED = 417;
159     /** {@code 421 Misdirected Request} (HTTP/2 - RFC 7540) */
160     int SC_MISDIRECTED_REQUEST = 421;
161 
162     /**
163      * Static constant for a 418 error.
164      * {@code 418 Unprocessable Entity} (WebDAV drafts?)
165      * or {@code 418 Reauthentication Required} (HTTP/1.1 drafts?)
166      */
167     // not used
168     // int SC_UNPROCESSABLE_ENTITY = 418;
169 
170     /**
171      * Static constant for a 419 error.
172      * {@code 419 Insufficient Space on Resource}
173      * (WebDAV - draft-ietf-webdav-protocol-05?)
174      * or {@code 419 Proxy Reauthentication Required}
175      * (HTTP/1.1 drafts?)
176      */
177     int SC_INSUFFICIENT_SPACE_ON_RESOURCE = 419;
178     /**
179      * Static constant for a 420 error.
180      * {@code 420 Method Failure}
181      * (WebDAV - draft-ietf-webdav-protocol-05?)
182      */
183     int SC_METHOD_FAILURE = 420;
184     /** {@code 422 Unprocessable Entity} (WebDAV - RFC 2518) */
185     int SC_UNPROCESSABLE_ENTITY = 422;
186     /** {@code 423 Locked} (WebDAV - RFC 2518) */
187     int SC_LOCKED = 423;
188     /** {@code 424 Failed Dependency} (WebDAV - RFC 2518) */
189     int SC_FAILED_DEPENDENCY = 424;
190     /** {@code 428 Precondition Required} (Additional HTTP Status Codes - RFC 6585) */
191     int SC_PRECONDITION_REQUIRED = 428;
192     /** {@code 429 Too Many Requests} (Additional HTTP Status Codes - RFC 6585) */
193     int SC_TOO_MANY_REQUESTS = 429;
194     /** {@code 431 Request Header Fields Too Large} (Additional HTTP Status Codes - RFC 6585) */
195     int SC_REQUEST_HEADER_FIELDS_TOO_LARGE = 431;
196     /** {@code 451 Unavailable For Legal Reasons} (Legal Obstacles - RFC 7725) */
197     int SC_UNAVAILABLE_FOR_LEGAL_REASONS = 451;
198 
199     // --- 5xx Server Error ---
200     /** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */
201     int SC_SERVER_ERROR = 500;
202 
203     /** {@code 500 Internal Server Error} (HTTP/1.0 - RFC 1945) */
204     int SC_INTERNAL_SERVER_ERROR = 500;
205     /** {@code 501 Not Implemented} (HTTP/1.0 - RFC 1945) */
206     int SC_NOT_IMPLEMENTED = 501;
207     /** {@code 502 Bad Gateway} (HTTP/1.0 - RFC 1945) */
208     int SC_BAD_GATEWAY = 502;
209     /** {@code 503 Service Unavailable} (HTTP/1.0 - RFC 1945) */
210     int SC_SERVICE_UNAVAILABLE = 503;
211     /** {@code 504 Gateway Timeout} (HTTP/1.1 - RFC 2616) */
212     int SC_GATEWAY_TIMEOUT = 504;
213     /** {@code 505 HTTP Version Not Supported} (HTTP/1.1 - RFC 2616) */
214     int SC_HTTP_VERSION_NOT_SUPPORTED = 505;
215     /** {@code 506 Variant Also Negotiates} ( Transparent Content Negotiation - RFC2295) */
216     int SC_VARIANT_ALSO_NEGOTIATES = 506;
217     /** {@code 507 Insufficient Storage} (WebDAV - RFC 2518) */
218     int SC_INSUFFICIENT_STORAGE = 507;
219 
220     /**
221      * {@code 508 Loop Detected} (WebDAV - RFC 5842, p.33, section 7.2)
222      */
223     int SC_LOOP_DETECTED = 508;
224 
225     /**
226      * {@code 510 Not Extended} (An HTTP Extension Framework - RFC 2774, p. 10, section 7)
227      */
228     int SC_NOT_EXTENDED = 510;
229 
230     /** {@code  511 Network Authentication Required} (Additional HTTP Status Codes - RFC 6585) */
231     int SC_NETWORK_AUTHENTICATION_REQUIRED = 511;
232 }