Top Description Fields Constructors Methods
org.apache.hc.client5.http

public Class HttpResponseException

extends ClientProtocolException
Class Inheritance
Imports
org.apache.hc.core5.http.ContentType, org.apache.hc.core5.util.TextUtils

Signals a non 2xx HTTP response.
Since
4.0

Field Summary

Modifier and TypeField and Description
private final byte[]
private final ContentType
private final String
private static final long
private final int

Constructor Summary

AccessConstructor and Description
public
HttpResponseException(final int
the HTTP status code
statusCode
,
final String
the reason phrase associated with the HTTP status code
reasonPhrase
)

Constructs a new instance of HttpResponseException with the given status code and reason phrase, and no content bytes or content type.

public
HttpResponseException(final int
the HTTP status code
statusCode
,
final String
the reason phrase associated with the HTTP status code
reasonPhrase
,
final byte[]
the content bytes of the HTTP response
contentBytes
,
final ContentType
the content type of the HTTP response
contentType
)

Constructs a new instance of HttpResponseException with the given status code, reason phrase, content bytes, and content type.

Method Summary

Modifier and TypeMethod and Description
public byte[]
public ContentType
public String
public int

Field Detail

contentBytesback to summary
private final byte[] contentBytes
contentTypeback to summary
private final ContentType contentType
reasonPhraseback to summary
private final String reasonPhrase
serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.apache.hc.client5.http.ClientProtocolException.serialVersionUID.

statusCodeback to summary
private final int statusCode

Constructor Detail

HttpResponseExceptionback to summary
public HttpResponseException(final int statusCode, final String reasonPhrase)

Constructs a new instance of HttpResponseException with the given status code and reason phrase, and no content bytes or content type.

Parameters
statusCode:int

the HTTP status code

reasonPhrase:String

the reason phrase associated with the HTTP status code

HttpResponseExceptionback to summary
public HttpResponseException(final int statusCode, final String reasonPhrase, final byte[] contentBytes, final ContentType contentType)

Constructs a new instance of HttpResponseException with the given status code, reason phrase, content bytes, and content type.

Parameters
statusCode:int

the HTTP status code

reasonPhrase:String

the reason phrase associated with the HTTP status code

contentBytes:byte[]

the content bytes of the HTTP response

contentType:ContentType

the content type of the HTTP response

Method Detail

getContentBytesback to summary
public byte[] getContentBytes()
getContentTypeback to summary
public ContentType getContentType()
getReasonPhraseback to summary
public String getReasonPhrase()
getStatusCodeback to summary
public int getStatusCode()