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