public abstract class

HttpStatusCodeException

extends RestClientException
java.lang.Object
   ↳ java.lang.Throwable
     ↳ java.lang.Exception
       ↳ java.lang.RuntimeException
         ↳ org.springframework.core.NestedRuntimeException
           ↳ org.springframework.web.client.RestClientException
             ↳ org.springframework.web.client.HttpStatusCodeException
Known Direct Subclasses

Class Overview

Abstract base class for exceptions based on an HttpStatus.

Summary

Protected Constructors
HttpStatusCodeException(HttpStatus statusCode)
Construct a new instance of HttpStatusCodeException based on a HttpStatus.
HttpStatusCodeException(HttpStatus statusCode, String statusText)
Construct a new instance of HttpStatusCodeException based on a HttpStatus and status text.
HttpStatusCodeException(HttpStatus statusCode, String statusText, byte[] responseBody, Charset responseCharset)
Construct a new instance of HttpStatusCodeException based on a HttpStatus, status text, and response body content.
Public Methods
byte[] getResponseBodyAsByteArray()
Returns the response body as a byte array.
String getResponseBodyAsString()
Returns the response body as a string.
HttpStatus getStatusCode()
Returns the HTTP status code.
String getStatusText()
Returns the HTTP status text.
[Expand]
Inherited Methods
From class org.springframework.core.NestedRuntimeException
From class java.lang.Throwable
From class java.lang.Object

Protected Constructors

protected HttpStatusCodeException (HttpStatus statusCode)

Construct a new instance of HttpStatusCodeException based on a HttpStatus.

Parameters
statusCode the status code

protected HttpStatusCodeException (HttpStatus statusCode, String statusText)

Construct a new instance of HttpStatusCodeException based on a HttpStatus and status text.

Parameters
statusCode the status code
statusText the status text

protected HttpStatusCodeException (HttpStatus statusCode, String statusText, byte[] responseBody, Charset responseCharset)

Construct a new instance of HttpStatusCodeException based on a HttpStatus, status text, and response body content.

Parameters
statusCode the status code
statusText the status text
responseBody the response body content, may be null
responseCharset the response body charset, may be null

Public Methods

public byte[] getResponseBodyAsByteArray ()

Returns the response body as a byte array.

public String getResponseBodyAsString ()

Returns the response body as a string.

public HttpStatus getStatusCode ()

Returns the HTTP status code.

public String getStatusText ()

Returns the HTTP status text.