org.jboss.seam.rest.exceptions
Class SeamExceptionMapper
java.lang.Object
org.jboss.seam.rest.exceptions.SeamExceptionMapper
- All Implemented Interfaces:
- javax.ws.rs.ext.ExceptionMapper<Throwable>
- Direct Known Subclasses:
- CatchExceptionMapper
@Provider
@ApplicationScoped
public class SeamExceptionMapper
- extends Object
- implements javax.ws.rs.ext.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
|
Method Summary |
protected void |
addExceptionMapping(org.jboss.seam.rest.exceptions.Mapping mapping)
|
protected Object |
createEntityBody(org.jboss.seam.rest.exceptions.Mapping mapping,
String message)
|
protected String |
createMessage(String message,
boolean interpolate,
boolean useExceptionMessage,
Throwable e,
org.jboss.solder.el.Expressions expressions)
|
Map<Class<? extends Throwable>,org.jboss.seam.rest.exceptions.Mapping> |
getMappings()
|
void |
init(javax.enterprise.inject.Instance<org.jboss.seam.rest.SeamRestConfiguration> configuration,
ExceptionMappingExtension extension)
Mappings are stored in a Map so that we can find them by the exception type. |
void |
init(javax.servlet.ServletContext ctx)
This observer method triggers #init(ExceptionMappingConfiguration) on bootstrap. |
protected void |
produceResponse(Throwable exception,
javax.ws.rs.core.Response.ResponseBuilder builder)
|
javax.ws.rs.core.Response |
toResponse(Throwable e)
|
| 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(javax.enterprise.inject.Instance<org.jboss.seam.rest.SeamRestConfiguration> configuration,
ExceptionMappingExtension extension)
- Mappings are stored in a Map so that we can find them by the exception type.
addExceptionMapping
protected void addExceptionMapping(org.jboss.seam.rest.exceptions.Mapping mapping)
init
public void init(@Observes@RestResource
javax.servlet.ServletContext ctx)
- This observer method triggers
#init(ExceptionMappingConfiguration) on bootstrap.
toResponse
public javax.ws.rs.core.Response toResponse(Throwable e)
- Specified by:
toResponse in interface javax.ws.rs.ext.ExceptionMapper<Throwable>
produceResponse
protected void produceResponse(Throwable exception,
javax.ws.rs.core.Response.ResponseBuilder builder)
createMessage
protected String createMessage(String message,
boolean interpolate,
boolean useExceptionMessage,
Throwable e,
org.jboss.solder.el.Expressions expressions)
createEntityBody
protected Object createEntityBody(org.jboss.seam.rest.exceptions.Mapping mapping,
String message)
getMappings
public Map<Class<? extends Throwable>,org.jboss.seam.rest.exceptions.Mapping> getMappings()
Copyright © 2011 Seam Framework. All Rights Reserved.