Class HttpException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
BadRequestException, ForbiddenException, InternalServerErrorException, MethodNotAllowedException, NotAcceptableException, NotFoundException, ServiceUnavailableException, UnauthorizedException, UnsupportedMediaTypeException

public class HttpException extends RuntimeException

Base exception class used to report HTTP errors.

Since:
1.0
Author:
Jeremy Kuhn
See Also:
  • Constructor Details

    • HttpException

      public HttpException()

      Creates a HTTP exception with default status Internal Server Error (500).

    • HttpException

      public HttpException(String message)

      Creates a HTTP exception with default status Internal Server Error (500) and specified message.

      Parameters:
      message - a message
    • HttpException

      public HttpException(Throwable cause)

      Creates a HTTP exception with default status Internal Server Error (500) and specified cause.

      Parameters:
      cause - a cause
    • HttpException

      public HttpException(String message, Throwable cause)

      Creates a HTTP exception with default status Internal Server Error (500), specified message and cause

      Parameters:
      message - a message
      cause - a cause
    • HttpException

      public HttpException(int statusCode) throws IllegalArgumentException

      Creates a HTTP exception with specified HTTP status code.

      Parameters:
      statusCode - a HTTP status code
      Throws:
      IllegalArgumentException - if the specified status doesn't correspond to a known HTTP status
    • HttpException

      public HttpException(int statusCode, String message) throws IllegalArgumentException

      Creates a HTTP exception with specified HTTP status code and message.

      Parameters:
      statusCode - a HTTP status code
      message - a message
      Throws:
      IllegalArgumentException - if the specified status doesn't correspond to a known HTTP status
    • HttpException

      public HttpException(int statusCode, Throwable cause) throws IllegalArgumentException

      Creates a HTTP exception with specified HTTP status code and cause.

      Parameters:
      statusCode - a HTTP status code
      cause - a cause
      Throws:
      IllegalArgumentException - if the specified status doesn't correspond to a known HTTP status
    • HttpException

      public HttpException(int statusCode, String message, Throwable cause) throws IllegalArgumentException

      Creates a HTTP exception with specified HTTP status code, message and cause.

      Parameters:
      statusCode - a HTTP status code
      message - a message
      cause - a cause
      Throws:
      IllegalArgumentException - if the specified status doesn't correspond to a known HTTP status
    • HttpException

      public HttpException(Status status)

      Creates a HTTP exception with specified HTTP status.

      Parameters:
      status - a HTTP status
    • HttpException

      public HttpException(Status status, String message)

      Creates a HTTP exception with specified HTTP status and message.

      Parameters:
      status - a HTTP status
      message - a message
    • HttpException

      public HttpException(Status status, Throwable cause)

      Creates a HTTP exception with specified HTTP status and cause.

      Parameters:
      status - a HTTP status
      cause - a cause
    • HttpException

      public HttpException(Status status, String message, Throwable cause)

      Creates a HTTP exception with specified HTTP status, message and cause.

      Parameters:
      status - a HTTP status
      message - a message
      cause - a cause
  • Method Details

    • getStatusCode

      public int getStatusCode()

      Returns the HTTP status code.

      Returns:
      a HTTP status code
    • getStatusReasonPhrase

      public String getStatusReasonPhrase()

      Returns the HTTP status reason phrase.

      Returns:
      a reason phrase
    • getStatusCategory

      public Status.Category getStatusCategory()

      Returns the HTTP status category.

      Returns:
      a HTTP status category