ccc.api.jaxrs.providers
Class RestExceptionMapper
java.lang.Object
ccc.api.jaxrs.providers.RestExceptionMapper
- All Implemented Interfaces:
- javax.ws.rs.ext.ExceptionMapper<CCException>
public class RestExceptionMapper
- extends java.lang.Object
- implements javax.ws.rs.ext.ExceptionMapper<CCException>
An mapper for 'command failed' exceptions.
- Author:
- Civic Computing Ltd.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RestExceptionMapper
public RestExceptionMapper()
toResponse
public javax.ws.rs.core.Response toResponse(CCException e)
-
- Specified by:
toResponse
in interface javax.ws.rs.ext.ExceptionMapper<CCException>
toResponse
public javax.ws.rs.core.Response toResponse(CCException e,
MimeType responseType)
- Convert an exception to a JAX-RS response.
- Parameters:
e
- The exception to convert.responseType
- The mime type for the response.
- Returns:
- The corresponding JAX-RS response.
fromResponse
public <T extends CCException> T fromResponse(java.lang.String body)
- Map from a response to the corresponding exception.
- Type Parameters:
T
- The type of exception expected.- Parameters:
body
- The HTTP response body.
- Returns:
- The corresponding exception.
Copyright © 2010. All Rights Reserved.