Top Description Fields Constructors Methods
org.springframework.web.client

public abstract Class HttpStatusCodeException

extends RestClientResponseException
Class Inheritance
Known Direct Subclasses
org.springframework.web.client.HttpClientErrorException, org.springframework.web.client.HttpServerErrorException
Imports
java.nio.charset.Charset, org.springframework.http.HttpHeaders, .HttpStatus, .HttpStatusCode, org.springframework.lang.Nullable, org.springframework.util.StringUtils

Abstract base class for exceptions based on an HttpStatusCode.
Authors
Arjen Poutsma, Chris Beams, Rossen Stoyanchev
Since
3.0

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
protected
HttpStatusCodeException(HttpStatusCode
the status code
statusCode
)

Construct a new instance with an HttpStatusCode.

protected
HttpStatusCodeException(HttpStatusCode
the status code
statusCode
,
String
the status text
statusText
)

Construct a new instance with an HttpStatusCode and status text.

protected
HttpStatusCodeException(HttpStatusCode
the status code
statusCode
,
String
the status text
statusText
,
byte[]
the response body content, may be null
responseBody
,
Charset
the response body charset, may be null
responseCharset
)

Construct instance with an HttpStatusCode, status text, and content.

protected
HttpStatusCodeException(HttpStatusCode
the status code
statusCode
,
String
the status text
statusText
,
HttpHeaders
the response headers, may be null
responseHeaders
,
byte[]
the response body content, may be null
responseBody
,
Charset
the response body charset, may be null
responseCharset
)

Construct instance with an HttpStatusCode, status text, content, and a response charset.

protected
HttpStatusCodeException(String
the exception message
message
,
HttpStatusCode
the status code
statusCode
,
String
the status text
statusText
,
HttpHeaders
the response headers, may be null
responseHeaders
,
byte[]
the response body content, may be null
responseBody
,
Charset
the response body charset, may be null
responseCharset
)

Construct instance with an HttpStatusCode, status text, content, and a response charset.

Method Summary

Modifier and TypeMethod and Description
private static String
getMessage(HttpStatusCode statusCode, String statusText)

private static String
name(HttpStatusCode statusCode)

Inherited from org.springframework.web.client.RestClientResponseException:
getRawStatusCodegetResponseBodyAsgetResponseBodyAsgetResponseBodyAsByteArraygetResponseBodyAsStringgetResponseBodyAsStringgetResponseHeadersgetStatusCodegetStatusTextsetBodyConvertFunction

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.springframework.web.client.RestClientResponseException.serialVersionUID.

Constructor Detail

HttpStatusCodeExceptionback to summary
protected HttpStatusCodeException(HttpStatusCode statusCode)

Construct a new instance with an HttpStatusCode.

Parameters
statusCode:HttpStatusCode

the status code

HttpStatusCodeExceptionback to summary
protected HttpStatusCodeException(HttpStatusCode statusCode, String statusText)

Construct a new instance with an HttpStatusCode and status text.

Parameters
statusCode:HttpStatusCode

the status code

statusText:String

the status text

HttpStatusCodeExceptionback to summary
protected HttpStatusCodeException(HttpStatusCode statusCode, String statusText, byte[] responseBody, Charset responseCharset)

Construct instance with an HttpStatusCode, status text, and content.

Parameters
statusCode:HttpStatusCode

the status code

statusText:String

the status text

responseBody:byte[]

the response body content, may be null

responseCharset:Charset

the response body charset, may be null

Since
3.0.5
HttpStatusCodeExceptionback to summary
protected HttpStatusCodeException(HttpStatusCode statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody, Charset responseCharset)

Construct instance with an HttpStatusCode, status text, content, and a response charset.

Parameters
statusCode:HttpStatusCode

the status code

statusText:String

the status text

responseHeaders:HttpHeaders

the response headers, may be null

responseBody:byte[]

the response body content, may be null

responseCharset:Charset

the response body charset, may be null

Since
3.1.2
HttpStatusCodeExceptionback to summary
protected HttpStatusCodeException(String message, HttpStatusCode statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody, Charset responseCharset)

Construct instance with an HttpStatusCode, status text, content, and a response charset.

Parameters
message:String

the exception message

statusCode:HttpStatusCode

the status code

statusText:String

the status text

responseHeaders:HttpHeaders

the response headers, may be null

responseBody:byte[]

the response body content, may be null

responseCharset:Charset

the response body charset, may be null

Since
5.2.2

Method Detail

getMessageback to summary
private static String getMessage(HttpStatusCode statusCode, String statusText)
nameback to summary
private static String name(HttpStatusCode statusCode)