@Contract(threading=IMMUTABLE) public final class StatusLine extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
StatusLine.StatusClass
Standard classes of HTTP status codes, plus
OTHER for non-standard codes. |
Constructor and Description |
---|
StatusLine(HttpResponse response) |
StatusLine(ProtocolVersion version,
int statusCode,
String reasonPhrase)
Creates a new status line with the given version, status, and reason.
|
Modifier and Type | Method and Description |
---|---|
ProtocolVersion |
getProtocolVersion() |
String |
getReasonPhrase() |
StatusLine.StatusClass |
getStatusClass() |
int |
getStatusCode() |
boolean |
isClientError()
Whether this status code is in the HTTP series
StatusLine.StatusClass.CLIENT_ERROR . |
boolean |
isError()
Whether this status code is in the HTTP series
StatusLine.StatusClass.CLIENT_ERROR
or StatusLine.StatusClass.SERVER_ERROR . |
boolean |
isInformational()
Whether this status code is in the HTTP series
StatusLine.StatusClass.INFORMATIONAL . |
boolean |
isRedirection()
Whether this status code is in the HTTP series
StatusLine.StatusClass.REDIRECTION . |
boolean |
isServerError()
Whether this status code is in the HTTP series
StatusLine.StatusClass.SERVER_ERROR . |
boolean |
isSuccessful()
Whether this status code is in the HTTP series
StatusLine.StatusClass.SUCCESSFUL . |
String |
toString() |
public StatusLine(HttpResponse response)
public StatusLine(ProtocolVersion version, int statusCode, String reasonPhrase)
version
- the protocol version of the responsestatusCode
- the status code of the responsereasonPhrase
- the reason phrase to the status code, or
null
public int getStatusCode()
public StatusLine.StatusClass getStatusClass()
public boolean isInformational()
StatusLine.StatusClass.INFORMATIONAL
.StatusLine.StatusClass.INFORMATIONAL
.public boolean isSuccessful()
StatusLine.StatusClass.SUCCESSFUL
.StatusLine.StatusClass.SUCCESSFUL
.public boolean isRedirection()
StatusLine.StatusClass.REDIRECTION
.StatusLine.StatusClass.REDIRECTION
.public boolean isClientError()
StatusLine.StatusClass.CLIENT_ERROR
.StatusLine.StatusClass.CLIENT_ERROR
.public boolean isServerError()
StatusLine.StatusClass.SERVER_ERROR
.StatusLine.StatusClass.SERVER_ERROR
.public boolean isError()
StatusLine.StatusClass.CLIENT_ERROR
or StatusLine.StatusClass.SERVER_ERROR
.StatusLine.StatusClass.CLIENT_ERROR
or StatusLine.StatusClass.SERVER_ERROR
.public ProtocolVersion getProtocolVersion()
public String getReasonPhrase()
Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.