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