java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.avaje.jex.http.HttpResponseException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BadRequestException,InternalServerErrorException,NotFoundException,RedirectException
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 Summary
ConstructorsConstructorDescriptionHttpResponseException(int status, Object jsonResponse) Create with a status and response that will sent as JSON.HttpResponseException(int status, String message) Create with a status and message. -
Method Summary
Modifier and TypeMethodDescriptionReturn the response body that will sent as JSON.intstatus()Return the status code.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
HttpResponseException
Create with a status and message.- Parameters:
status- the http status to sendmessage- the exception message that will be sent back in the response
-
HttpResponseException
Create with a status and response that will sent as JSON.- Parameters:
status- the http status to sendjsonResponse- the response body that will be sent back as json
-
-
Method Details
-
status
public int status()Return the status code. -
jsonResponse
Return the response body that will sent as JSON.
-