org.jboss.seam.rest.exceptions
Class SeamExceptionMapper
java.lang.Object
org.jboss.seam.rest.exceptions.SeamExceptionMapper
- All Implemented Interfaces:
- ExceptionMapper<Throwable>
- Direct Known Subclasses:
- CatchExceptionMapper
@Provider
@ApplicationScoped
public class SeamExceptionMapper
- extends Object
- implements ExceptionMapper<Throwable>
This ExceptionMapper
implementation converts caught exceptions to HTTP responses based on exception mapping rules.
If there is no matching rule for an exception, the exception is rethrown wrapped within UnhandledException
. Note that
this implementation is replaced by CatchExceptionMapper in environments where Seam Catch is available.
- Author:
- Jozef Hartinger
- See Also:
ExceptionMappingConfiguration
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SeamExceptionMapper
public SeamExceptionMapper()
init
@Inject
public void init(Instance<SeamRestConfiguration> configuration,
ExceptionMappingExtension extension)
- Mappings are stored in a Map so that we can find them by the exception type.
addExceptionMapping
protected void addExceptionMapping(Mapping mapping)
init
public void init(@Observes@RestResource
ServletContext ctx)
- This observer method triggers
#init(ExceptionMappingConfiguration)
on bootstrap.
toResponse
public Response toResponse(Throwable e)
- Specified by:
toResponse
in interface ExceptionMapper<Throwable>
produceResponse
protected void produceResponse(Throwable exception,
Response.ResponseBuilder builder,
Interpolator interpolator)
createMessage
protected String createMessage(String message,
boolean interpolate,
boolean useExceptionMessage,
Throwable e,
Interpolator interpolator)
createEntityBody
protected Object createEntityBody(Mapping mapping,
String message)
getMappings
public Map<Class<? extends Throwable>,Mapping> getMappings()
Copyright © 2011 Seam Framework. All Rights Reserved.