T
- A type of the exception processed by the exception mapper.@Singleton public abstract class AbstractErrorTemplateMapper<T extends Throwable> extends Object implements ExtendedExceptionMapper<T>
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.Constructor and Description |
---|
AbstractErrorTemplateMapper() |
Modifier and Type | Method and Description |
---|---|
protected Object |
getErrorModel(T throwable)
Get a model for error template.
|
protected javax.ws.rs.core.Response.Status |
getErrorStatus(T throwable)
Get a response status of to-be-processed error template.
|
boolean |
isMappable(T throwable)
Determine whether this provider is able to process a supplied exception instance.
|
javax.ws.rs.core.Response |
toResponse(T throwable) |
public final boolean isMappable(T throwable)
ExtendedExceptionMapper
This method is called only on those exception mapping providers that are able to
process the type of the exception
as defined by the JAX-RS
ExceptionMapper
contract. By returning false
this method can reject
any given exception instance and change the default JAX-RS exception mapper
selection behaviour.
isMappable
in interface ExtendedExceptionMapper<T extends Throwable>
throwable
- exception instance which should be processed.true
if the mapper is able to map the particular exception instance,
false
otherwise.public final javax.ws.rs.core.Response toResponse(T throwable)
protected Object getErrorModel(T throwable)
throwable
itself.throwable
- throwable raised during processing a resource method.protected javax.ws.rs.core.Response.Status getErrorStatus(T throwable)
Response.Status#OK
.throwable
- throwable raised during processing a resource method.Copyright © 2007-2015, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.