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   *
33   * @since 4.0
34   */
35  public final class HttpStatus {
36  
37      private HttpStatus() {
38          // no instances.
39      }
40  
41      // --- 1xx Informational ---
42      /** {@code 100 1xx Informational} (HTTP Semantics) */
43      public static final int SC_INFORMATIONAL = 100;
44  
45      /** {@code 100 Continue} (HTTP Semantics) */
46      public static final int SC_CONTINUE = 100;
47      /** {@code 101 Switching Protocols} (HTTP Semantics)*/
48      public static final int SC_SWITCHING_PROTOCOLS = 101;
49      /** {@code 102 Processing} (WebDAV - RFC 2518) */
50      public static final int SC_PROCESSING = 102;
51      /** {@code 103 Early Hints (Early Hints - RFC 8297)}*/
52      public static final int SC_EARLY_HINTS = 103;
53  
54      // --- 2xx Success ---
55      /** {@code 2xx Success} (HTTP Semantics) */
56      public static final int SC_SUCCESS = 200;
57  
58      /** {@code 200 OK} (HTTP Semantics) */
59      public static final int SC_OK = 200;
60      /** {@code 201 Created} (HTTP Semantics) */
61      public static final int SC_CREATED = 201;
62      /** {@code 202 Accepted} (HTTP Semantics) */
63      public static final int SC_ACCEPTED = 202;
64      /** {@code 203 Non Authoritative Information} (HTTP Semantics) */
65      public static final int SC_NON_AUTHORITATIVE_INFORMATION = 203;
66      /** {@code 204 No Content} (HTTP Semantics) */
67      public static final int SC_NO_CONTENT = 204;
68      /** {@code 205 Reset Content} (HTTP Semantics) */
69      public static final int SC_RESET_CONTENT = 205;
70      /** {@code 206 Partial Content} (HTTP Semantics) */
71      public static final int SC_PARTIAL_CONTENT = 206;
72      /**
73       * {@code 207 Multi-Status} (WebDAV - RFC 2518)
74       * or
75       * {@code 207 Partial Update OK} (HTTP/1.1 - draft-ietf-http-v11-spec-rev-01?)
76       */
77      public static final int SC_MULTI_STATUS = 207;
78      /**
79       * {@code 208 Already Reported} (WebDAV - RFC 5842, p.30, section 7.1)
80       */
81      public static final int SC_ALREADY_REPORTED = 208;
82      /**
83       * {@code 226 IM Used} (Delta encoding in HTTP - RFC 3229, p. 30, section 10.4.1)
84       */
85      public static final int SC_IM_USED = 226;
86  
87      // --- 3xx Redirection ---
88      /** {@code 3xx Redirection} (HTTP Semantics) */
89      public static final int SC_REDIRECTION = 300;
90  
91      /** {@code 300 Multiple Choices} (HTTP Semantics) */
92      public static final int SC_MULTIPLE_CHOICES = 300;
93      /** {@code 301 Moved Permanently} (HTTP Semantics) */
94      public static final int SC_MOVED_PERMANENTLY = 301;
95      /** {@code 302 Moved Temporarily} (Sometimes {@code Found}) (HTTP Semantics) */
96      public static final int SC_MOVED_TEMPORARILY = 302;
97      /** {@code 303 See Other} (HTTP Semantics) */
98      public static final int SC_SEE_OTHER = 303;
99      /** {@code 304 Not Modified} (HTTP Semantics) */
100     public static final int SC_NOT_MODIFIED = 304;
101     /** {@code 305 Use Proxy} (HTTP Semantics) */
102     public static final int SC_USE_PROXY = 305;
103     /** {@code 307 Temporary Redirect} (HTTP Semantics) */
104     public static final int SC_TEMPORARY_REDIRECT = 307;
105 
106     /** {@code 308 Permanent Redirect} (HTTP Semantics) */
107     public static final int SC_PERMANENT_REDIRECT = 308;
108 
109     // --- 4xx Client Error ---
110     /** {@code 4xx Client Error} (HTTP Semantics) */
111     public static final int SC_CLIENT_ERROR = 400;
112 
113     /** {@code 400 Bad Request} (HTTP Semantics) */
114     public static final int SC_BAD_REQUEST = 400;
115     /** {@code 401 Unauthorized} (HTTP Semantics) */
116     public static final int SC_UNAUTHORIZED = 401;
117     /** {@code 402 Payment Required} (HTTP Semantics) */
118     public static final int SC_PAYMENT_REQUIRED = 402;
119     /** {@code 403 Forbidden} (HTTP Semantics) */
120     public static final int SC_FORBIDDEN = 403;
121     /** {@code 404 Not Found} (HTTP Semantics) */
122     public static final int SC_NOT_FOUND = 404;
123     /** {@code 405 Method Not Allowed} (HTTP Semantics) */
124     public static final int SC_METHOD_NOT_ALLOWED = 405;
125     /** {@code 406 Not Acceptable} (HTTP Semantics) */
126     public static final int SC_NOT_ACCEPTABLE = 406;
127     /** {@code 407 Proxy Authentication Required} (HTTP Semantics)*/
128     public static final int SC_PROXY_AUTHENTICATION_REQUIRED = 407;
129     /** {@code 408 Request Timeout} (HTTP Semantics) */
130     public static final int SC_REQUEST_TIMEOUT = 408;
131     /** {@code 409 Conflict} (HTTP Semantics) */
132     public static final int SC_CONFLICT = 409;
133     /** {@code 410 Gone} (HTTP Semantics) */
134     public static final int SC_GONE = 410;
135     /** {@code 411 Length Required} (HTTP Semantics) */
136     public static final int SC_LENGTH_REQUIRED = 411;
137     /** {@code 412 Precondition Failed} (HTTP Semantics) */
138     public static final int SC_PRECONDITION_FAILED = 412;
139     /** {@code 413 Request Entity Too Large} (HTTP Semantics) */
140     public static final int SC_REQUEST_TOO_LONG = 413;
141     /** {@code 414 Request-URI Too Long} (HTTP Semantics) */
142     public static final int SC_REQUEST_URI_TOO_LONG = 414;
143     /** {@code 415 Unsupported Media Type} (HTTP Semantics) */
144     public static final int SC_UNSUPPORTED_MEDIA_TYPE = 415;
145     /** {@code 416 Requested Range Not Satisfiable} (HTTP Semantics) */
146     public static final int SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
147     /** {@code 417 Expectation Failed} (HTTP Semantics) */
148     public static final int SC_EXPECTATION_FAILED = 417;
149     /** {@code 421 Misdirected Request} (HTTP Semantics) */
150     public static final int SC_MISDIRECTED_REQUEST = 421;
151     /** {@code 422 Unprocessable Content} (HTTP Semantics) */
152     public static final int SC_UNPROCESSABLE_CONTENT = 422;
153     /** {@code 426 Upgrade Required} (HTTP Semantics) */
154     public static final int SC_UPGRADE_REQUIRED = 426;
155 
156     /**
157      * Static constant for a 419 error.
158      * {@code 419 Insufficient Space on Resource}
159      * (WebDAV - draft-ietf-webdav-protocol-05?)
160      * or {@code 419 Proxy Reauthentication Required}
161      * (HTTP/1.1 drafts?)
162      */
163     public static final int SC_INSUFFICIENT_SPACE_ON_RESOURCE = 419;
164     /**
165      * Static constant for a 420 error.
166      * {@code 420 Method Failure}
167      * (WebDAV - draft-ietf-webdav-protocol-05?)
168      */
169     public static final int SC_METHOD_FAILURE = 420;
170     /**
171      * @deprecated Use {@link #SC_UNPROCESSABLE_CONTENT}
172      */
173     @Deprecated
174     public static final int SC_UNPROCESSABLE_ENTITY = SC_UNPROCESSABLE_CONTENT;
175     /** {@code 423 Locked} (WebDAV - RFC 2518) */
176     public static final int SC_LOCKED = 423;
177     /** {@code 424 Failed Dependency} (WebDAV - RFC 2518) */
178     public static final int SC_FAILED_DEPENDENCY = 424;
179     /** {@code 425 Too Early} (Using Early Data in HTTP - RFC 8470) */
180     public static final int SC_TOO_EARLY = 425;
181     /** {@code 428 Precondition Required} (Additional HTTP Status Codes - RFC 6585) */
182     public static final int SC_PRECONDITION_REQUIRED = 428;
183     /** {@code 429 Too Many Requests} (Additional HTTP Status Codes - RFC 6585) */
184     public static final int SC_TOO_MANY_REQUESTS = 429;
185     /** {@code 431 Request Header Fields Too Large} (Additional HTTP Status Codes - RFC 6585) */
186     public static final int SC_REQUEST_HEADER_FIELDS_TOO_LARGE = 431;
187     /** {@code 451 Unavailable For Legal Reasons} (Legal Obstacles - RFC 7725) */
188     public static final int SC_UNAVAILABLE_FOR_LEGAL_REASONS = 451;
189 
190     // --- 5xx Server Error ---
191     /** {@code 500 Server Error} (HTTP Semantics) */
192     public static final int SC_SERVER_ERROR = 500;
193 
194     /** {@code 500 Internal Server Error} (HTTP Semantics) */
195     public static final int SC_INTERNAL_SERVER_ERROR = 500;
196     /** {@code 501 Not Implemented} (HTTP Semantics) */
197     public static final int SC_NOT_IMPLEMENTED = 501;
198     /** {@code 502 Bad Gateway} (HTTP Semantics) */
199     public static final int SC_BAD_GATEWAY = 502;
200     /** {@code 503 Service Unavailable} (HTTP Semantics) */
201     public static final int SC_SERVICE_UNAVAILABLE = 503;
202     /** {@code 504 Gateway Timeout} (HTTP Semantics) */
203     public static final int SC_GATEWAY_TIMEOUT = 504;
204     /** {@code 505 HTTP Version Not Supported} (HTTP Semantics) */
205     public static final int SC_HTTP_VERSION_NOT_SUPPORTED = 505;
206     /** {@code 506 Variant Also Negotiates} ( Transparent Content Negotiation - RFC 2295) */
207     public static final int SC_VARIANT_ALSO_NEGOTIATES = 506;
208     /** {@code 507 Insufficient Storage} (WebDAV - RFC 2518) */
209     public static final int SC_INSUFFICIENT_STORAGE = 507;
210 
211     /**
212      * {@code 508 Loop Detected} (WebDAV - RFC 5842, p.33, section 7.2)
213      */
214     public static final int SC_LOOP_DETECTED = 508;
215 
216     /**
217      * {@code 510 Not Extended} (An HTTP Extension Framework - RFC 2774, p. 10, section 7)
218      */
219     public static final int SC_NOT_EXTENDED = 510;
220 
221     /** {@code  511 Network Authentication Required} (Additional HTTP Status Codes - RFC 6585) */
222     public static final int SC_NETWORK_AUTHENTICATION_REQUIRED = 511;
223 }