Package google.registry.request
Class HttpException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
google.registry.request.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
Base for exceptions that cause an HTTP error response.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Exception that causes a 400 response.static final class
Exception that causes a 409 response.static final class
Exception that causes a 403 response.static final class
Exception that causes a 500 response.static final class
Exception that causes a 405 response.static final class
Exception that causes a 204 response.static final class
Exception that causes a 404 response.static final class
Exception that causes a 501 response.static final class
Exception that causes a 304 response.static final class
Exception that causes a 503 response.static final class
Exception that causes a 422 response.static final class
Exception that causes a 415 response. -
Constructor Summary
ModifierConstructorDescriptionprotected
HttpException
(int responseCode, String message, Throwable cause) protected
HttpException
(int responseCode, String message, Throwable cause, Level logLevel) -
Method Summary
Modifier and TypeMethodDescriptionfinal int
Returns the string associated with a particular response code.final void
send
(jakarta.servlet.http.HttpServletResponse rsp) Transmits the error response to the client.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
HttpException
-
HttpException
-
-
Method Details
-
getResponseCode
public final int getResponseCode() -
getResponseCodeString
Returns the string associated with a particular response code. UnlikeThrowable.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 ofHttpException
. -
send
Transmits the error response to the client.Throwable.getMessage()
will be sent to the browser, whereasThrowable.toString()
andThrowable.getCause()
will be logged.- Throws:
IOException
-