org.springframework.web.client

## Class HttpServerErrorException

- 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
            - - org.springframework.web.client.HttpServerErrorException

- All Implemented Interfaces:
    Serializable

      public class HttpServerErrorException
      extends HttpStatusCodeException

  Exception thrown when an HTTP 5xx is received.
  Since:
    3.0
  Author:
    Arjen Poutsma
  See Also:
    `DefaultResponseErrorHandler`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpServerErrorException(HttpStatus statusCode)` Construct a new instance of `HttpServerErrorException` based on an `HttpStatus`.
    `HttpServerErrorException(HttpStatus statusCode, String statusText)` Construct a new instance of `HttpServerErrorException` based on an `HttpStatus` and status text.
    `HttpServerErrorException(HttpStatus statusCode, String statusText, byte[] responseBody, Charset responseCharset)` Construct a new instance of `HttpServerErrorException` based on an `HttpStatus`, status text, and response body content.
    `HttpServerErrorException(HttpStatus statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody, Charset responseCharset)` Construct a new instance of `HttpServerErrorException` based on a `HttpStatus`, status text, and response body content.

  - ### Method Summary

    - ### Methods inherited from class org.springframework.web.client.HttpStatusCodeException

      `getResponseBodyAsByteArray, getResponseBodyAsString, getResponseHeaders, getStatusCode, getStatusText`

    - ### Methods inherited from class org.springframework.core.NestedRuntimeException

      `contains, getMessage, getMostSpecificCause, getRootCause`

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### HttpServerErrorException

          public HttpServerErrorException(HttpStatus statusCode)

      Construct a new instance of `HttpServerErrorException` based on an `HttpStatus`.
      Parameters:
        `statusCode` - the status code

    - #### HttpServerErrorException

          public HttpServerErrorException(HttpStatus statusCode,
                                  String statusText)

      Construct a new instance of `HttpServerErrorException` based on an `HttpStatus` and status text.
      Parameters:
        `statusCode` - the status code
        `statusText` - the status text

    - #### HttpServerErrorException

          public HttpServerErrorException(HttpStatus statusCode,
                                  String statusText,
                                  byte[] responseBody,
                                  Charset responseCharset)

      Construct a new instance of `HttpServerErrorException` based on an `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`
      Since:
        3.0.5

    - #### HttpServerErrorException

          public HttpServerErrorException(HttpStatus statusCode,
                                  String statusText,
                                  HttpHeaders responseHeaders,
                                  byte[] responseBody,
                                  Charset responseCharset)

      Construct a new instance of `HttpServerErrorException` based on a `HttpStatus`, status text, and response body content.
      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