Package net.officefloor.server.http
Class HttpException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
net.officefloor.server.http.HttpException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AccessTokenException,AuthenticationContinuationException,BadRequestHttpException,InvalidatedSessionHttpException,NotFoundHttpException,RefreshTokenException,RetrieveValueException,StoringSessionHttpException,ValidateKeysException
HTTP Exception.
This is a RuntimeException as typically this is handled directly by
the HttpServerImplementation to send a HttpResponse. It is
typically not for application logic to handle.
- Author:
- Daniel Sagenschneider
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionHttpException(int statusCode, String errorMessage) Convenience constructor for providing error message.HttpException(Throwable cause) HttpException(HttpStatus status) Instantiate.HttpException(HttpStatus status, String errorMessage) Convenience constructor for providing error message.HttpException(HttpStatus status, Throwable cause) Instantiate.HttpException(HttpStatus status, WritableHttpHeader[] headers, String entity) Instantiate. -
Method Summary
Modifier and TypeMethodDescriptionObtains the entity for theHttpResponse.Obtains theHttpHeaderinstances.Obtains theHttpStatusfor theHttpResponse.<B> voidwriteHttpResponse(HttpVersion version, boolean isIncludeStackTrace, StreamBuffer<B> head, StreamBufferPool<B> bufferPool) Writes the HTTP response for thisHttpException.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
HttpException
Instantiate.- Parameters:
status-HttpStatus.
-
HttpException
Instantiate.- Parameters:
status-HttpStatus.cause-Throwablecause.
-
HttpException
Convenience constructor for providing error message.- Parameters:
statusCode- Status code.errorMessage- Error message.
-
HttpException
Convenience constructor for providing error message.- Parameters:
status-HttpStatus.errorMessage- Error message.
-
HttpException
Instantiate.- Parameters:
status-HttpStatus.headers-HttpHeaderinstances. May benull.entity- Entity for theHttpResponse. May benull.
-
HttpException
- Parameters:
cause-Throwablecause.
-
-
Method Details
-
getHttpStatus
Obtains theHttpStatusfor theHttpResponse.- Returns:
HttpStatusfor theHttpResponse.
-
getHttpHeaders
Obtains theHttpHeaderinstances.- Returns:
HttpHeaderinstances.
-
getEntity
Obtains the entity for theHttpResponse.- Returns:
- Entity for the
HttpResponse.
-
writeHttpResponse
public <B> void writeHttpResponse(HttpVersion version, boolean isIncludeStackTrace, StreamBuffer<B> head, StreamBufferPool<B> bufferPool) Writes the HTTP response for thisHttpException.- Type Parameters:
B- Buffer type.- Parameters:
version-HttpVersion.isIncludeStackTrace- Whether to include the stack trace.head- HeadStreamBufferof the linked list ofStreamBufferinstances.bufferPool-StreamBufferPool.
-
getMessage
- Overrides:
getMessagein classThrowable
-