Class HttpResponseException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
BadRequestException, InternalServerErrorException, NotFoundException, RedirectException

public class HttpResponseException extends RuntimeException
Throwing an uncaught HttpResponseException will interrupt http processing and set the status code and response body with the given message or json body
See Also:
  • Constructor Details

    • HttpResponseException

      public HttpResponseException(HttpStatus status)
      Create with a status and use the default message for that status.
      Parameters:
      status - the http status to send
    • HttpResponseException

      public HttpResponseException(HttpStatus status, String message)
      Create with a status and message.
      Parameters:
      status - the http status to send
      message - the exception message that will be sent back in the response
    • HttpResponseException

      public HttpResponseException(int status, String message)
      Create with a status and message.
      Parameters:
      status - the http status to send
      message - the exception message that will be sent back in the response
    • HttpResponseException

      public HttpResponseException(int status, Object jsonResponse)
      Create with a status and response that will sent as JSON.
      Parameters:
      status - the http status to send
      jsonResponse - the response body that will be sent back as json
  • Method Details

    • status

      public int status()
      Return the status code.
    • jsonResponse

      public Object jsonResponse()
      Return the response body that will sent as JSON.