ccc.api.jaxrs.providers
Class RestExceptionMapper

java.lang.Object
  extended by 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.

Constructor Summary
RestExceptionMapper()
           
 
Method Summary
<T extends CCException>
T
fromResponse(java.lang.String body)
          Map from a response to the corresponding exception.
 javax.ws.rs.core.Response toResponse(CCException e)
          
 javax.ws.rs.core.Response toResponse(CCException e, MimeType responseType)
          Convert an exception to a JAX-RS response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RestExceptionMapper

public RestExceptionMapper()
Method Detail

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.