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