Package org.microproxy.http
Record Class HttpResponseStatus
java.lang.Object
java.lang.Record
org.microproxy.http.HttpResponseStatus
- Record Components:
code- three-digit status code, from 100 to 999reasonPhrase- reason phrase, without CR or LF characters
An HTTP status code and reason phrase. Equality considers only the code, so a response from a
server with a non-standard reason phrase still equals the corresponding constant.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatusstatic final HttpResponseStatus -
Constructor Summary
ConstructorsConstructorDescriptionHttpResponseStatus(int code, String reasonPhrase) Creates a status with a validated code and reason phrase. -
Method Summary
Modifier and TypeMethodDescriptionintcode()Returns the value of thecoderecord component.booleanIndicates whether some other object is "equal to" this one.inthashCode()Returns a hash code value for this object.Returns the value of thereasonPhraserecord component.toString()Returns a string representation of this record class.static HttpResponseStatusvalueOf(int code) Returns the well-known status forcode, or a new one with a generic phrase.static HttpResponseStatusReturns a status withcodeandreasonPhrase, reusing constants when equal.
-
Field Details
-
CONTINUE
-
SWITCHING_PROTOCOLS
-
OK
-
CREATED
-
ACCEPTED
-
NO_CONTENT
-
MOVED_PERMANENTLY
-
FOUND
-
NOT_MODIFIED
-
BAD_REQUEST
-
UNAUTHORIZED
-
FORBIDDEN
-
NOT_FOUND
-
METHOD_NOT_ALLOWED
-
PROXY_AUTHENTICATION_REQUIRED
-
REQUEST_TIMEOUT
-
REQUEST_ENTITY_TOO_LARGE
-
EXPECTATION_FAILED
-
TOO_MANY_REQUESTS
-
REQUEST_HEADER_FIELDS_TOO_LARGE
-
INTERNAL_SERVER_ERROR
-
NOT_IMPLEMENTED
-
BAD_GATEWAY
-
SERVICE_UNAVAILABLE
-
GATEWAY_TIMEOUT
-
-
Constructor Details
-
HttpResponseStatus
Creates a status with a validated code and reason phrase.- Parameters:
code- three-digit status code, from 100 to 999reasonPhrase- reason phrase, without CR or LF characters- Throws:
IllegalArgumentException- if the code or reason phrase is invalid
-
-
Method Details
-
valueOf
Returns the well-known status forcode, or a new one with a generic phrase.- Parameters:
code- three-digit status code- Returns:
- a status with the standard or generic reason phrase
- Throws:
IllegalArgumentException- if the code is outside 100 to 999
-
valueOf
Returns a status withcodeandreasonPhrase, reusing constants when equal.- Parameters:
code- three-digit status codereasonPhrase- reason phrase, without CR or LF characters- Returns:
- a status retaining the supplied reason phrase
- Throws:
IllegalArgumentException- if the code or reason phrase is invalid
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
code
public int code()Returns the value of thecoderecord component.- Returns:
- the value of the
coderecord component
-
reasonPhrase
Returns the value of thereasonPhraserecord component.- Returns:
- the value of the
reasonPhraserecord component
-