Class HttpStatusCodeException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
HttpClientErrorException, HttpServerErrorException

public abstract class HttpStatusCodeException extends RestClientResponseException
Abstract base class for exceptions based on an HttpStatus.
Since:
3.0
Author:
Arjen Poutsma, Chris Beams, Rossen Stoyanchev
See Also:
  • Constructor Details

    • HttpStatusCodeException

      protected HttpStatusCodeException(HttpStatus statusCode)
      Construct a new instance with an HttpStatus.
      Parameters:
      statusCode - the status code
    • HttpStatusCodeException

      protected HttpStatusCodeException(HttpStatus statusCode, String statusText)
      Construct a new instance with an HttpStatus and status text.
      Parameters:
      statusCode - the status code
      statusText - the status text
    • HttpStatusCodeException

      protected HttpStatusCodeException(HttpStatus statusCode, String statusText, @Nullable byte[] responseBody, @Nullable Charset responseCharset)
      Construct instance with an HttpStatus, status text, and 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
      Since:
      3.0.5
    • HttpStatusCodeException

      protected HttpStatusCodeException(HttpStatus statusCode, String statusText, @Nullable HttpHeaders responseHeaders, @Nullable byte[] responseBody, @Nullable Charset responseCharset)
      Construct instance with an HttpStatus, status text, content, and a response charset.
      Parameters:
      statusCode - the status code
      statusText - the status text
      responseHeaders - the response headers, may be null
      responseBody - the response body content, may be null
      responseCharset - the response body charset, may be null
      Since:
      3.1.2
    • HttpStatusCodeException

      protected HttpStatusCodeException(String message, HttpStatus statusCode, String statusText, @Nullable HttpHeaders responseHeaders, @Nullable byte[] responseBody, @Nullable Charset responseCharset)
      Construct instance with an HttpStatus, status text, content, and a response charset.
      Parameters:
      message - the exception message
      statusCode - the status code
      statusText - the status text
      responseHeaders - the response headers, may be null
      responseBody - the response body content, may be null
      responseCharset - the response body charset, may be null
      Since:
      5.2.2
  • Method Details

    • getStatusCode

      public HttpStatus getStatusCode()
      Return the HTTP status code.