javax.ws.rs.ext
Interface ExceptionMapper<E extends Throwable>

Type Parameters:
E - exception type supported by the provider.

public interface ExceptionMapper<E extends Throwable>

Contract for a provider that maps Java exceptions to Response. An implementation of this interface must be annotated with Provider.

Since:
1.0
Author:
Paul Sandoz, Marc Hadley
See Also:
Provider, Response

Method Summary
 Response toResponse(E exception)
          Map an exception to a Response.
 

Method Detail

toResponse

Response toResponse(E exception)
Map an exception to a Response. Returning null results in a Response.Status.NO_CONTENT response. Throwing a runtime exception results in a Response.Status.INTERNAL_SERVER_ERROR response

Parameters:
exception - the exception to map to a response
Returns:
a response mapped from the supplied exception


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.