Top Description Fields Constructors Methods
io.netty5.handler.codec.http

public Class HttpResponseStatus

extends Object
implements Comparable<HttpResponseStatus>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable
Imports
io.netty5.buffer.Buffer, io.netty5.util.AsciiString, java.nio.charset.StandardCharsets

The response code and its description of HTTP or its derived protocols, such as RTSP and ICAP.

Field Summary

Modifier and TypeField and Description
public static final HttpResponseStatus
ACCEPTED

202 Accepted

public static final HttpResponseStatus
BAD_GATEWAY

502 Bad Gateway

public static final HttpResponseStatus
BAD_REQUEST

400 Bad Request

private final byte[]
private final int
private final AsciiString
private HttpStatusClass
public static final HttpResponseStatus
CONFLICT

409 Conflict

public static final HttpResponseStatus
CONTINUE

100 Continue

public static final HttpResponseStatus
CREATED

201 Created

public static final HttpResponseStatus
EXPECTATION_FAILED

417 Expectation Failed

public static final HttpResponseStatus
FAILED_DEPENDENCY

424 Failed Dependency (WebDAV, RFC4918)

public static final HttpResponseStatus
FORBIDDEN

403 Forbidden

public static final HttpResponseStatus
FOUND

302 Found

public static final HttpResponseStatus
GATEWAY_TIMEOUT

504 Gateway Timeout

public static final HttpResponseStatus
GONE

410 Gone

public static final HttpResponseStatus
HTTP_VERSION_NOT_SUPPORTED

505 HTTP Version Not Supported

public static final HttpResponseStatus
INSUFFICIENT_STORAGE

507 Insufficient Storage (WebDAV, RFC4918)

public static final HttpResponseStatus
INTERNAL_SERVER_ERROR

500 Internal Server Error

public static final HttpResponseStatus
LENGTH_REQUIRED

411 Length Required

public static final HttpResponseStatus
LOCKED

423 Locked (WebDAV, RFC4918)

public static final HttpResponseStatus
METHOD_NOT_ALLOWED

405 Method Not Allowed

public static final HttpResponseStatus
MISDIRECTED_REQUEST

421 Misdirected Request

public static final HttpResponseStatus
MOVED_PERMANENTLY

301 Moved Permanently

public static final HttpResponseStatus
MULTI_STATUS

207 Multi-Status (WebDAV, RFC2518)

public static final HttpResponseStatus
MULTIPLE_CHOICES

300 Multiple Choices

public static final HttpResponseStatus
NETWORK_AUTHENTICATION_REQUIRED

511 Network Authentication Required (RFC6585)

public static final HttpResponseStatus
NO_CONTENT

204 No Content

public static final HttpResponseStatus
NON_AUTHORITATIVE_INFORMATION

203 Non-Authoritative Information (since HTTP/1.1)

public static final HttpResponseStatus
NOT_ACCEPTABLE

406 Not Acceptable

public static final HttpResponseStatus
NOT_EXTENDED

510 Not Extended (RFC2774)

public static final HttpResponseStatus
NOT_FOUND

404 Not Found

public static final HttpResponseStatus
NOT_IMPLEMENTED

501 Not Implemented

public static final HttpResponseStatus
NOT_MODIFIED

304 Not Modified

public static final HttpResponseStatus
OK

200 OK

public static final HttpResponseStatus
PARTIAL_CONTENT

206 Partial Content

public static final HttpResponseStatus
PAYMENT_REQUIRED

402 Payment Required

public static final HttpResponseStatus
PERMANENT_REDIRECT

308 Permanent Redirect (RFC7538)

public static final HttpResponseStatus
PRECONDITION_FAILED

412 Precondition Failed

public static final HttpResponseStatus
PRECONDITION_REQUIRED

428 Precondition Required (RFC6585)

public static final HttpResponseStatus
PROCESSING

102 Processing (WebDAV, RFC2518)

public static final HttpResponseStatus
PROXY_AUTHENTICATION_REQUIRED

407 Proxy Authentication Required

private final String
public static final HttpResponseStatus
REQUEST_ENTITY_TOO_LARGE

413 Request Entity Too Large

public static final HttpResponseStatus
REQUEST_HEADER_FIELDS_TOO_LARGE

431 Request Header Fields Too Large (RFC6585)

public static final HttpResponseStatus
REQUEST_TIMEOUT

408 Request Timeout

public static final HttpResponseStatus
REQUEST_URI_TOO_LONG

414 Request-URI Too Long

public static final HttpResponseStatus
REQUESTED_RANGE_NOT_SATISFIABLE

416 Requested Range Not Satisfiable

public static final HttpResponseStatus
RESET_CONTENT

205 Reset Content

public static final HttpResponseStatus
SEE_OTHER

303 See Other (since HTTP/1.1)

public static final HttpResponseStatus
SERVICE_UNAVAILABLE

503 Service Unavailable

public static final HttpResponseStatus
SWITCHING_PROTOCOLS

101 Switching Protocols

public static final HttpResponseStatus
TEMPORARY_REDIRECT

307 Temporary Redirect (since HTTP/1.1)

public static final HttpResponseStatus
TOO_MANY_REQUESTS

429 Too Many Requests (RFC6585)

public static final HttpResponseStatus
UNAUTHORIZED

401 Unauthorized

public static final HttpResponseStatus
UNORDERED_COLLECTION

425 Unordered Collection (WebDAV, RFC3648)

public static final HttpResponseStatus
UNPROCESSABLE_ENTITY

422 Unprocessable Entity (WebDAV, RFC4918)

public static final HttpResponseStatus
UNSUPPORTED_MEDIA_TYPE

415 Unsupported Media Type

public static final HttpResponseStatus
UPGRADE_REQUIRED

426 Upgrade Required (RFC2817)

public static final HttpResponseStatus
USE_PROXY

305 Use Proxy (since HTTP/1.1)

public static final HttpResponseStatus
VARIANT_ALSO_NEGOTIATES

506 Variant Also Negotiates (RFC2295)

Constructor Summary

AccessConstructor and Description
private
HttpResponseStatus(int code)

Creates a new instance with the specified code and the auto-generated default reason phrase.

public
HttpResponseStatus(int code, String reasonPhrase)

Creates a new instance with the specified code and its reasonPhrase.

private
HttpResponseStatus(int code, String reasonPhrase, boolean bytes)

Method Summary

Modifier and TypeMethod and Description
public int
code()

Returns the code of this HttpResponseStatus.

public AsciiString
codeAsText()

Returns the status code as AsciiString.

public HttpStatusClass
codeClass()

Returns the class of this HttpResponseStatus

public int
compareTo(HttpResponseStatus
the object to be compared.
o
)

Implements java.lang.Comparable.compareTo.

Equality of HttpResponseStatus only depends on code().
pack-priv void
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Equality of HttpResponseStatus only depends on code().
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
private static HttpResponseStatus
newStatus(int statusCode, String reasonPhrase)

public static HttpResponseStatus
parseLine(CharSequence line)

Parses the specified HTTP status line into a HttpResponseStatus.

public static HttpResponseStatus
parseLine(String line)

Parses the specified HTTP status line into a HttpResponseStatus.

public static HttpResponseStatus
parseLine(AsciiString line)

Parses the specified HTTP status line into a HttpResponseStatus.

public String
reasonPhrase()

Returns the reason phrase of this HttpResponseStatus.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public static HttpResponseStatus
valueOf(int code)

Returns the HttpResponseStatus represented by the specified code.

public static HttpResponseStatus

Returns:

the HttpResponseStatus represented by the specified code and reasonPhrase.
valueOf
(int
The response code value.
code
,
String
The response code reason phrase.
reasonPhrase
)

Returns the HttpResponseStatus represented by the specified code and reasonPhrase.

private static HttpResponseStatus
valueOf0(int code)

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

ACCEPTEDback to summary
public static final HttpResponseStatus ACCEPTED

202 Accepted

BAD_GATEWAYback to summary
public static final HttpResponseStatus BAD_GATEWAY

502 Bad Gateway

BAD_REQUESTback to summary
public static final HttpResponseStatus BAD_REQUEST

400 Bad Request

bytesback to summary
private final byte[] bytes
codeback to summary
private final int code
codeAsTextback to summary
private final AsciiString codeAsText
codeClassback to summary
private HttpStatusClass codeClass
CONFLICTback to summary
public static final HttpResponseStatus CONFLICT

409 Conflict

CONTINUEback to summary
public static final HttpResponseStatus CONTINUE

100 Continue

CREATEDback to summary
public static final HttpResponseStatus CREATED

201 Created

EXPECTATION_FAILEDback to summary
public static final HttpResponseStatus EXPECTATION_FAILED

417 Expectation Failed

FAILED_DEPENDENCYback to summary
public static final HttpResponseStatus FAILED_DEPENDENCY

424 Failed Dependency (WebDAV, RFC4918)

FORBIDDENback to summary
public static final HttpResponseStatus FORBIDDEN

403 Forbidden

FOUNDback to summary
public static final HttpResponseStatus FOUND

302 Found

GATEWAY_TIMEOUTback to summary
public static final HttpResponseStatus GATEWAY_TIMEOUT

504 Gateway Timeout

GONEback to summary
public static final HttpResponseStatus GONE

410 Gone

HTTP_VERSION_NOT_SUPPORTEDback to summary
public static final HttpResponseStatus HTTP_VERSION_NOT_SUPPORTED

505 HTTP Version Not Supported

INSUFFICIENT_STORAGEback to summary
public static final HttpResponseStatus INSUFFICIENT_STORAGE

507 Insufficient Storage (WebDAV, RFC4918)

INTERNAL_SERVER_ERRORback to summary
public static final HttpResponseStatus INTERNAL_SERVER_ERROR

500 Internal Server Error

LENGTH_REQUIREDback to summary
public static final HttpResponseStatus LENGTH_REQUIRED

411 Length Required

LOCKEDback to summary
public static final HttpResponseStatus LOCKED

423 Locked (WebDAV, RFC4918)

METHOD_NOT_ALLOWEDback to summary
public static final HttpResponseStatus METHOD_NOT_ALLOWED

405 Method Not Allowed

MISDIRECTED_REQUESTback to summary
public static final HttpResponseStatus MISDIRECTED_REQUEST

421 Misdirected Request

See Also
421 (Misdirected Request) Status Code
MOVED_PERMANENTLYback to summary
public static final HttpResponseStatus MOVED_PERMANENTLY

301 Moved Permanently

MULTI_STATUSback to summary
public static final HttpResponseStatus MULTI_STATUS

207 Multi-Status (WebDAV, RFC2518)

MULTIPLE_CHOICESback to summary
public static final HttpResponseStatus MULTIPLE_CHOICES

300 Multiple Choices

NETWORK_AUTHENTICATION_REQUIREDback to summary
public static final HttpResponseStatus NETWORK_AUTHENTICATION_REQUIRED

511 Network Authentication Required (RFC6585)

NO_CONTENTback to summary
public static final HttpResponseStatus NO_CONTENT

204 No Content

NON_AUTHORITATIVE_INFORMATIONback to summary
public static final HttpResponseStatus NON_AUTHORITATIVE_INFORMATION

203 Non-Authoritative Information (since HTTP/1.1)

NOT_ACCEPTABLEback to summary
public static final HttpResponseStatus NOT_ACCEPTABLE

406 Not Acceptable

NOT_EXTENDEDback to summary
public static final HttpResponseStatus NOT_EXTENDED

510 Not Extended (RFC2774)

NOT_FOUNDback to summary
public static final HttpResponseStatus NOT_FOUND

404 Not Found

NOT_IMPLEMENTEDback to summary
public static final HttpResponseStatus NOT_IMPLEMENTED

501 Not Implemented

NOT_MODIFIEDback to summary
public static final HttpResponseStatus NOT_MODIFIED

304 Not Modified

OKback to summary
public static final HttpResponseStatus OK

200 OK

PARTIAL_CONTENTback to summary
public static final HttpResponseStatus PARTIAL_CONTENT

206 Partial Content

PAYMENT_REQUIREDback to summary
public static final HttpResponseStatus PAYMENT_REQUIRED

402 Payment Required

PERMANENT_REDIRECTback to summary
public static final HttpResponseStatus PERMANENT_REDIRECT

308 Permanent Redirect (RFC7538)

PRECONDITION_FAILEDback to summary
public static final HttpResponseStatus PRECONDITION_FAILED

412 Precondition Failed

PRECONDITION_REQUIREDback to summary
public static final HttpResponseStatus PRECONDITION_REQUIRED

428 Precondition Required (RFC6585)

PROCESSINGback to summary
public static final HttpResponseStatus PROCESSING

102 Processing (WebDAV, RFC2518)

PROXY_AUTHENTICATION_REQUIREDback to summary
public static final HttpResponseStatus PROXY_AUTHENTICATION_REQUIRED

407 Proxy Authentication Required

reasonPhraseback to summary
private final String reasonPhrase
REQUEST_ENTITY_TOO_LARGEback to summary
public static final HttpResponseStatus REQUEST_ENTITY_TOO_LARGE

413 Request Entity Too Large

REQUEST_HEADER_FIELDS_TOO_LARGEback to summary
public static final HttpResponseStatus REQUEST_HEADER_FIELDS_TOO_LARGE

431 Request Header Fields Too Large (RFC6585)

REQUEST_TIMEOUTback to summary
public static final HttpResponseStatus REQUEST_TIMEOUT

408 Request Timeout

REQUEST_URI_TOO_LONGback to summary
public static final HttpResponseStatus REQUEST_URI_TOO_LONG

414 Request-URI Too Long

REQUESTED_RANGE_NOT_SATISFIABLEback to summary
public static final HttpResponseStatus REQUESTED_RANGE_NOT_SATISFIABLE

416 Requested Range Not Satisfiable

RESET_CONTENTback to summary
public static final HttpResponseStatus RESET_CONTENT

205 Reset Content

SEE_OTHERback to summary
public static final HttpResponseStatus SEE_OTHER

303 See Other (since HTTP/1.1)

SERVICE_UNAVAILABLEback to summary
public static final HttpResponseStatus SERVICE_UNAVAILABLE

503 Service Unavailable

SWITCHING_PROTOCOLSback to summary
public static final HttpResponseStatus SWITCHING_PROTOCOLS

101 Switching Protocols

TEMPORARY_REDIRECTback to summary
public static final HttpResponseStatus TEMPORARY_REDIRECT

307 Temporary Redirect (since HTTP/1.1)

TOO_MANY_REQUESTSback to summary
public static final HttpResponseStatus TOO_MANY_REQUESTS

429 Too Many Requests (RFC6585)

UNAUTHORIZEDback to summary
public static final HttpResponseStatus UNAUTHORIZED

401 Unauthorized

UNORDERED_COLLECTIONback to summary
public static final HttpResponseStatus UNORDERED_COLLECTION

425 Unordered Collection (WebDAV, RFC3648)

UNPROCESSABLE_ENTITYback to summary
public static final HttpResponseStatus UNPROCESSABLE_ENTITY

422 Unprocessable Entity (WebDAV, RFC4918)

UNSUPPORTED_MEDIA_TYPEback to summary
public static final HttpResponseStatus UNSUPPORTED_MEDIA_TYPE

415 Unsupported Media Type

UPGRADE_REQUIREDback to summary
public static final HttpResponseStatus UPGRADE_REQUIRED

426 Upgrade Required (RFC2817)

USE_PROXYback to summary
public static final HttpResponseStatus USE_PROXY

305 Use Proxy (since HTTP/1.1)

VARIANT_ALSO_NEGOTIATESback to summary
public static final HttpResponseStatus VARIANT_ALSO_NEGOTIATES

506 Variant Also Negotiates (RFC2295)

Constructor Detail

HttpResponseStatusback to summary
private HttpResponseStatus(int code)

Creates a new instance with the specified code and the auto-generated default reason phrase.

HttpResponseStatusback to summary
public HttpResponseStatus(int code, String reasonPhrase)

Creates a new instance with the specified code and its reasonPhrase.

HttpResponseStatusback to summary
private HttpResponseStatus(int code, String reasonPhrase, boolean bytes)

Method Detail

codeback to summary
public int code()

Returns the code of this HttpResponseStatus.

codeAsTextback to summary
public AsciiString codeAsText()

Returns the status code as AsciiString.

codeClassback to summary
public HttpStatusClass codeClass()

Returns the class of this HttpResponseStatus

compareToback to summary
public int compareTo(HttpResponseStatus o)

Implements java.lang.Comparable.compareTo.

Equality of HttpResponseStatus only depends on code(). The reason phrase is not considered for equality.

Parameters
o:HttpResponseStatus

Doc from java.lang.Comparable.compareTo.

the object to be compared.

Returns:int

Doc from java.lang.Comparable.compareTo.

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
encodeback to summary
pack-priv void encode(Buffer buf)
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Equality of HttpResponseStatus only depends on code(). The reason phrase is not considered for equality.

Parameters
o:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
newStatusback to summary
private static HttpResponseStatus newStatus(int statusCode, String reasonPhrase)
parseLineback to summary
public static HttpResponseStatus parseLine(CharSequence line)

Parses the specified HTTP status line into a HttpResponseStatus. The expected formats of the line are:

  • statusCode (e.g. 200)
  • statusCode reasonPhrase (e.g. 404 Not Found)
Exceptions
IllegalArgumentException:
if the specified status line is malformed
parseLineback to summary
public static HttpResponseStatus parseLine(String line)

Parses the specified HTTP status line into a HttpResponseStatus. The expected formats of the line are:

  • statusCode (e.g. 200)
  • statusCode reasonPhrase (e.g. 404 Not Found)
Exceptions
IllegalArgumentException:
if the specified status line is malformed
parseLineback to summary
public static HttpResponseStatus parseLine(AsciiString line)

Parses the specified HTTP status line into a HttpResponseStatus. The expected formats of the line are:

  • statusCode (e.g. 200)
  • statusCode reasonPhrase (e.g. 404 Not Found)
Exceptions
IllegalArgumentException:
if the specified status line is malformed
reasonPhraseback to summary
public String reasonPhrase()

Returns the reason phrase of this HttpResponseStatus.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
valueOfback to summary
public static HttpResponseStatus valueOf(int code)

Returns the HttpResponseStatus represented by the specified code. If the specified code is a standard HTTP status code, a cached instance will be returned. Otherwise, a new instance will be returned.

valueOfback to summary
public static HttpResponseStatus valueOf(int code, String reasonPhrase)

Returns the HttpResponseStatus represented by the specified code and reasonPhrase. If the specified code is a standard HTTP status code and reasonPhrase, a cached instance will be returned. Otherwise, a new instance will be returned.

Parameters
code:int

The response code value.

reasonPhrase:String

The response code reason phrase.

Returns:HttpResponseStatus

the HttpResponseStatus represented by the specified code and reasonPhrase.

valueOf0back to summary
private static HttpResponseStatus valueOf0(int code)