- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BadRequestException,ForbiddenException,InternalServerErrorException,MethodNotAllowedException,NotAcceptableException,NotFoundException,ServiceUnavailableException,UnauthorizedException,UnsupportedMediaTypeException
Base exception class used to report HTTP errors.
- Since:
- 1.0
- Author:
- Jeremy Kuhn
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a HTTP exception with default statusInternal Server Error (500).HttpException(int statusCode) Creates a HTTP exception with specified HTTP status code.HttpException(int statusCode, String message) Creates a HTTP exception with specified HTTP status code and message.HttpException(int statusCode, String message, Throwable cause) Creates a HTTP exception with specified HTTP status code, message and cause.HttpException(int statusCode, Throwable cause) Creates a HTTP exception with specified HTTP status code and cause.HttpException(Status status) Creates a HTTP exception with specified HTTP status.HttpException(Status status, String message) Creates a HTTP exception with specified HTTP status and message.HttpException(Status status, String message, Throwable cause) Creates a HTTP exception with specified HTTP status, message and cause.HttpException(Status status, Throwable cause) Creates a HTTP exception with specified HTTP status and cause.HttpException(String message) Creates a HTTP exception with default statusInternal Server Error (500)and specified message.HttpException(String message, Throwable cause) Creates a HTTP exception with default statusInternal Server Error (500), specified message and causeHttpException(Throwable cause) Creates a HTTP exception with default statusInternal Server Error (500)and specified cause. -
Method Summary
Modifier and TypeMethodDescriptionReturns the HTTP status category.intReturns the HTTP status code.Returns the HTTP status reason phrase.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
HttpException
public HttpException()Creates a HTTP exception with default status
Internal Server Error (500). -
HttpException
Creates a HTTP exception with default status
Internal Server Error (500)and specified message.- Parameters:
message- a message
-
HttpException
Creates a HTTP exception with default status
Internal Server Error (500)and specified cause.- Parameters:
cause- a cause
-
HttpException
Creates a HTTP exception with default status
Internal Server Error (500), specified message and cause- Parameters:
message- a messagecause- a cause
-
HttpException
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
Creates a HTTP exception with specified HTTP status code and message.
- Parameters:
statusCode- a HTTP status codemessage- a message- Throws:
IllegalArgumentException- if the specified status doesn't correspond to a known HTTP status
-
HttpException
Creates a HTTP exception with specified HTTP status code and cause.
- Parameters:
statusCode- a HTTP status codecause- 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 codemessage- a messagecause- a cause- Throws:
IllegalArgumentException- if the specified status doesn't correspond to a known HTTP status
-
HttpException
Creates a HTTP exception with specified HTTP status.
- Parameters:
status- a HTTP status
-
HttpException
Creates a HTTP exception with specified HTTP status and message.
- Parameters:
status- a HTTP statusmessage- a message
-
HttpException
Creates a HTTP exception with specified HTTP status and cause.
- Parameters:
status- a HTTP statuscause- a cause
-
HttpException
Creates a HTTP exception with specified HTTP status, message and cause.
- Parameters:
status- a HTTP statusmessage- a messagecause- a cause
-
-
Method Details
-
getStatusCode
public int getStatusCode()Returns the HTTP status code.
- Returns:
- a HTTP status code
-
getStatusReasonPhrase
Returns the HTTP status reason phrase.
- Returns:
- a reason phrase
-
getStatusCategory
Returns the HTTP status category.
- Returns:
- a HTTP status category
-