Class HttpException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
HttpException.BadRequestException, HttpException.ConflictException, HttpException.ForbiddenException, HttpException.InternalServerErrorException, HttpException.MethodNotAllowedException, HttpException.NoContentException, HttpException.NotFoundException, HttpException.NotImplementedException, HttpException.NotModifiedException, HttpException.ServiceUnavailableException, HttpException.UnprocessableEntityException, HttpException.UnsupportedMediaTypeException

public abstract class HttpException extends RuntimeException
Base for exceptions that cause an HTTP error response.
See Also:
  • Constructor Details

    • HttpException

      protected HttpException(int responseCode, String message, Throwable cause, Level logLevel)
    • HttpException

      protected HttpException(int responseCode, String message, Throwable cause)
  • Method Details

    • getResponseCode

      public final int getResponseCode()
    • getResponseCodeString

      public String getResponseCodeString()
      Returns the string associated with a particular response code. Unlike Throwable.getMessage(), which is meant to describe the circumstances under which this particular exception occurred, this method always returns the same string (e.g. "Not Found" for a 400 error), and so should always be the same for a given subclass of HttpException.
    • send

      public final void send(jakarta.servlet.http.HttpServletResponse rsp) throws IOException
      Transmits the error response to the client.

      Throwable.getMessage() will be sent to the browser, whereas Throwable.toString() and Throwable.getCause() will be logged.

      Throws:
      IOException