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