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:
java.io.Serializable
- Direct Known Subclasses:
AccessTokenException,AuthenticationContinuationException,BadRequestHttpException,InvalidatedSessionHttpException,NotFoundHttpException,RefreshTokenException,RetrieveValueException,StoringSessionHttpException,ValidateKeysException
public class HttpException extends java.lang.RuntimeExceptionHTTP
Exception.This is a
RuntimeExceptionas typically this is handled directly by theHttpServerImplementationto send aHttpResponse. It is typically not for application logic to handle.- Author:
- Daniel Sagenschneider
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description HttpException(int statusCode, java.lang.String errorMessage)Convenience constructor for providing error message.HttpException(java.lang.Throwable cause)HttpException(HttpStatus status)Instantiate.HttpException(HttpStatus status, java.lang.String errorMessage)Convenience constructor for providing error message.HttpException(HttpStatus status, java.lang.Throwable cause)Instantiate.HttpException(HttpStatus status, WritableHttpHeader[] headers, java.lang.String entity)Instantiate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetEntity()Obtains the entity for theHttpResponse.HttpHeader[]getHttpHeaders()Obtains theHttpHeaderinstances.HttpStatusgetHttpStatus()Obtains theHttpStatusfor theHttpResponse.java.lang.StringgetMessage()<B> voidwriteHttpResponse(HttpVersion version, boolean isIncludeStackTrace, StreamBuffer<B> head, StreamBufferPool<B> bufferPool)Writes the HTTP response for thisHttpException.
-
-
-
Constructor Detail
-
HttpException
public HttpException(HttpStatus status)
Instantiate.- Parameters:
status-HttpStatus.
-
HttpException
public HttpException(HttpStatus status, java.lang.Throwable cause)
Instantiate.- Parameters:
status-HttpStatus.cause-Throwablecause.
-
HttpException
public HttpException(int statusCode, java.lang.String errorMessage)Convenience constructor for providing error message.- Parameters:
statusCode- Status code.errorMessage- Error message.
-
HttpException
public HttpException(HttpStatus status, java.lang.String errorMessage)
Convenience constructor for providing error message.- Parameters:
status-HttpStatus.errorMessage- Error message.
-
HttpException
public HttpException(HttpStatus status, WritableHttpHeader[] headers, java.lang.String entity)
Instantiate.- Parameters:
status-HttpStatus.headers-HttpHeaderinstances. May benull.entity- Entity for theHttpResponse. May benull.
-
HttpException
public HttpException(java.lang.Throwable cause)
- Parameters:
cause-Throwablecause.
-
-
Method Detail
-
getHttpStatus
public HttpStatus getHttpStatus()
Obtains theHttpStatusfor theHttpResponse.- Returns:
HttpStatusfor theHttpResponse.
-
getHttpHeaders
public HttpHeader[] getHttpHeaders()
Obtains theHttpHeaderinstances.- Returns:
HttpHeaderinstances.
-
getEntity
public java.lang.String 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
public java.lang.String getMessage()
- Overrides:
getMessagein classjava.lang.Throwable
-
-