Top Description Inners Fields Constructors Methods
org.apache.hc.core5.http.message

public final Class StatusLine

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Annotations
@Contract
threading:IMMUTABLE
Imports
java.io.Serializable, org.apache.hc.core5.annotation.Contract, .ThreadingBehavior, org.apache.hc.core5.http.HttpResponse, .HttpVersion, .ProtocolVersion, org.apache.hc.core5.util.Args

HTTP/1.1 status line.
Since
4.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
StatusLine.StatusClass

Standard classes of HTTP status codes, plus OTHER for non-standard codes.

Field Summary

Modifier and TypeField and Description
private final ProtocolVersion
protoVersion

The protocol version.

private final String
reasonPhrase

The reason phrase.

private static final long
private final StatusLine.StatusClass
statusClass

The status code class.

private final int
statusCode

The status code.

Constructor Summary

AccessConstructor and Description
public
StatusLine(final HttpResponse response)

public
StatusLine(final ProtocolVersion
the protocol version of the response
version
,
final int
the status code of the response
statusCode
,
final String
the reason phrase to the status code, or null
reasonPhrase
)

Creates a new status line with the given version, status, and reason.

Method Summary

Modifier and TypeMethod and Description
public ProtocolVersion
public String
public StatusLine.StatusClass
public int
public boolean
isClientError()

Whether this status code is in the HTTP series StatusClass#CLIENT_ERROR.

public boolean
isError()

Whether this status code is in the HTTP series StatusClass#CLIENT_ERROR or StatusClass#SERVER_ERROR.

public boolean
isInformational()

Whether this status code is in the HTTP series StatusClass#INFORMATIONAL.

public boolean
isRedirection()

Whether this status code is in the HTTP series StatusClass#REDIRECTION.

public boolean
isServerError()

Whether this status code is in the HTTP series StatusClass#SERVER_ERROR.

public boolean
isSuccessful()

Whether this status code is in the HTTP series StatusClass#SUCCESSFUL.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

protoVersionback to summary
private final ProtocolVersion protoVersion

The protocol version.

reasonPhraseback to summary
private final String reasonPhrase

The reason phrase.

serialVersionUIDback to summary
private static final long serialVersionUID
statusClassback to summary
private final StatusLine.StatusClass statusClass

The status code class.

statusCodeback to summary
private final int statusCode

The status code.

Constructor Detail

StatusLineback to summary
public StatusLine(final HttpResponse response)
StatusLineback to summary
public StatusLine(final ProtocolVersion version, final int statusCode, final String reasonPhrase)

Creates a new status line with the given version, status, and reason.

Parameters
version:ProtocolVersion

the protocol version of the response

statusCode:int

the status code of the response

reasonPhrase:String

the reason phrase to the status code, or null

Method Detail

getProtocolVersionback to summary
public ProtocolVersion getProtocolVersion()
getReasonPhraseback to summary
public String getReasonPhrase()
getStatusClassback to summary
public StatusLine.StatusClass getStatusClass()
getStatusCodeback to summary
public int getStatusCode()
isClientErrorback to summary
public boolean isClientError()

Whether this status code is in the HTTP series StatusClass#CLIENT_ERROR.

Since
5.1
isErrorback to summary
public boolean isError()

Whether this status code is in the HTTP series StatusClass#CLIENT_ERROR or StatusClass#SERVER_ERROR.

Since
5.1
isInformationalback to summary
public boolean isInformational()

Whether this status code is in the HTTP series StatusClass#INFORMATIONAL.

Since
5.1
isRedirectionback to summary
public boolean isRedirection()

Whether this status code is in the HTTP series StatusClass#REDIRECTION.

Since
5.1
isServerErrorback to summary
public boolean isServerError()

Whether this status code is in the HTTP series StatusClass#SERVER_ERROR.

Since
5.1
isSuccessfulback to summary
public boolean isSuccessful()

Whether this status code is in the HTTP series StatusClass#SUCCESSFUL.

Since
5.1
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
org.apache.hc.core5.http.message back to summary

public final Enum StatusLine.StatusClass

extends Enum<StatusLine.StatusClass>
Class Inheritance

Standard classes of HTTP status codes, plus OTHER for non-standard codes.

Field Summary

Modifier and TypeField and Description
public static final StatusLine.StatusClass
CLIENT_ERROR

Client Error 4xx HTTP status codes.

public static final StatusLine.StatusClass
INFORMATIONAL

Informational 1xx HTTP status codes.

public static final StatusLine.StatusClass
OTHER

Any other HTTP status codes (e.g. non-standard status codes).

public static final StatusLine.StatusClass
REDIRECTION

Redirection 3xx HTTP status codes.

public static final StatusLine.StatusClass
SERVER_ERROR

5xx HTTP status codes.

public static final StatusLine.StatusClass
SUCCESSFUL

Successful 2xx HTTP status codes.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static StatusLine.StatusClass

Returns:

class of the response status code.
from
(final int
response status code to get the class for.
statusCode
)

Gets the response status class for the given status code.

public static StatusLine.StatusClass
public static StatusLine.StatusClass[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CLIENT_ERRORback to summary
public static final StatusLine.StatusClass CLIENT_ERROR

Client Error 4xx HTTP status codes.

INFORMATIONALback to summary
public static final StatusLine.StatusClass INFORMATIONAL

Informational 1xx HTTP status codes.

OTHERback to summary
public static final StatusLine.StatusClass OTHER

Any other HTTP status codes (e.g. non-standard status codes).

REDIRECTIONback to summary
public static final StatusLine.StatusClass REDIRECTION

Redirection 3xx HTTP status codes.

SERVER_ERRORback to summary
public static final StatusLine.StatusClass SERVER_ERROR

5xx HTTP status codes.

SUCCESSFULback to summary
public static final StatusLine.StatusClass SUCCESSFUL

Successful 2xx HTTP status codes.

Constructor Detail

StatusClassback to summary
private StatusClass()

Method Detail

fromback to summary
public static StatusLine.StatusClass from(final int statusCode)

Gets the response status class for the given status code.

Parameters
statusCode:int

response status code to get the class for.

Returns:StatusLine.StatusClass

class of the response status code.

valueOfback to summary
public static StatusLine.StatusClass valueOf(String name)
valuesback to summary
public static StatusLine.StatusClass[] values()