Class AbstractErrorTemplateMapper<T extends Throwable>
java.lang.Object
org.glassfish.jersey.server.mvc.spi.AbstractErrorTemplateMapper<T>
- Type Parameters:
T- A type of the exception processed by the exception mapper.
- All Implemented Interfaces:
ExceptionMapper<T>,ExtendedExceptionMapper<T>
- Direct Known Subclasses:
ErrorTemplateExceptionMapper
@Singleton
public abstract class AbstractErrorTemplateMapper<T extends Throwable>
extends Object
implements ExtendedExceptionMapper<T>
Default implementation of
ExtendedExceptionMapper used to declare special handling for exception types that should be
processed by MVC.
Extensions should override getErrorStatus(Throwable) and getErrorModel(Throwable) to provide a response
status and model derived from a raised throwable.
By default every exception is mapped and used as a model in a viewable and passed to the MVC runtime for
further processing.- Since:
- 2.3
- Author:
- Michal Gajdos
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectgetErrorModel(T throwable) Get a model for error template.protected Response.StatusgetErrorStatus(T throwable) Get a response status of to-be-processed error template.final booleanisMappable(T throwable) final ResponsetoResponse(T throwable)
-
Constructor Details
-
AbstractErrorTemplateMapper
public AbstractErrorTemplateMapper()
-
-
Method Details
-
isMappable
- Specified by:
isMappablein interfaceExtendedExceptionMapper<T extends Throwable>
-
toResponse
- Specified by:
toResponsein interfaceExceptionMapper<T extends Throwable>
-
getErrorModel
Get a model for error template. Default value is thethrowableitself.- Parameters:
throwable- throwable raised during processing a resource method.- Returns:
- a model for error template.
-
getErrorStatus
Get a response status of to-be-processed error template. Default value isResponse.Status.OK.- Parameters:
throwable- throwable raised during processing a resource method.- Returns:
- response status of error response.
-