|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.jersey.internal.ExceptionMapperFactory
public class ExceptionMapperFactory
Exception mappers implementation that aggregates
exception mappers and server as the main entry point for exception mapper
instance lookup.
| Nested Class Summary | |
|---|---|
static class |
ExceptionMapperFactory.Binder
Exception mapper factory injection binder. |
| Constructor Summary | |
|---|---|
ExceptionMapperFactory(org.glassfish.hk2.api.ServiceLocator locator)
Create new exception mapper factory initialized with HK2 service locator instance that will be used to look up all providers implementing
ExceptionMapper interface. |
|
| Method Summary | ||
|---|---|---|
|
find(Class<T> type)
Get an exception mapping provider for a particular class of exception. |
|
|
findMapping(T exceptionInstance)
Get an exception mapping provider for a particular exception instance. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
@Inject public ExceptionMapperFactory(org.glassfish.hk2.api.ServiceLocator locator)
HK2 service locator instance that will be used to look up all providers implementing
ExceptionMapper interface.
locator - HK2 service locator.| Method Detail |
|---|
public <T extends Throwable> ExceptionMapper<T> findMapping(T exceptionInstance)
ExceptionMappers
This method is similar to method ExceptionMappers.find(Class). In addition it takes
into an account the result of the ExtendedExceptionMapper.isMappable(Throwable)
of any mapper that implements Jersey ExtendedExceptionMapper API.
If an extended exception mapper returns false from isMappable(Throwable),
the mapper is disregarded from the search.
Exception mapping providers are checked one by one until a first provider returns
true from the isMappable(Throwable) method or until a first provider
is found which best supports the exception type and does not implement ExtendedExceptionMapper
API (i.e. it is a standard JAX-RS ExceptionMapper). The order in which the providers are
checked is determined by the distance of the declared exception mapper type and the actual exception
type.
Note that if an exception mapping provider does not implement ExtendedExceptionMapper
it is always considered applicable for a given exception instance.
findMapping in interface ExceptionMappersT - type of the exception handled by the exception mapping provider.exceptionInstance - exception to be handled by the exception mapping provider.
ExceptionMapper for the supplied exception instance type or null if none
is found.public <T extends Throwable> ExceptionMapper<T> find(Class<T> type)
ExceptionMapperstype.
find in interface ExceptionMappersT - type of the exception handled by the exception mapping provider.type - the class of exception.
ExceptionMapper for the supplied type or null
if none is found.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||