org.glassfish.jersey.server.internal
Class MappableExceptionWrapperInterceptor

java.lang.Object
  extended by org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor
All Implemented Interfaces:
ReaderInterceptor, WriterInterceptor

@Priority(value=10)
@Singleton
public class MappableExceptionWrapperInterceptor
extends Object
implements ReaderInterceptor, WriterInterceptor

Interceptor that wraps specific exceptions types thrown by wrapped interceptors and by message body readers and writers into a mappable exception. It must have the lowest priority in order to wrap all other interceptors.

Author:
Miroslav Fuksa (miroslav.fuksa at oracle.com)

Nested Class Summary
static class MappableExceptionWrapperInterceptor.Binder
          Binder registering the Exception Wrapper Interceptor (used on the client side).
 
Constructor Summary
MappableExceptionWrapperInterceptor()
           
 
Method Summary
 Object aroundReadFrom(ReaderInterceptorContext context)
          Interceptor method wrapping calls to MessageBodyReader.readFrom(java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.InputStream) method.
 void aroundWriteTo(WriterInterceptorContext context)
          Interceptor method wrapping calls to MessageBodyWriter.writeTo(T, java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.OutputStream) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MappableExceptionWrapperInterceptor

public MappableExceptionWrapperInterceptor()
Method Detail

aroundReadFrom

public Object aroundReadFrom(ReaderInterceptorContext context)
                      throws IOException,
                             WebApplicationException
Description copied from interface: ReaderInterceptor
Interceptor method wrapping calls to MessageBodyReader.readFrom(java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.InputStream) method. The parameters of the wrapped method called are available from context. Implementations of this method SHOULD explicitly call ReaderInterceptorContext.proceed() to invoke the next interceptor in the chain, and ultimately the wrapped MessageBodyReader.readFrom(java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.InputStream) method.

Specified by:
aroundReadFrom in interface ReaderInterceptor
Parameters:
context - invocation context.
Returns:
result of next interceptor invoked or the wrapped method if last interceptor in chain.
Throws:
IOException - if an IO error arises or is thrown by the wrapped MessageBodyReader.readFrom method.
WebApplicationException - thrown by the wrapped MessageBodyReader.readFrom method.

aroundWriteTo

public void aroundWriteTo(WriterInterceptorContext context)
                   throws IOException,
                          WebApplicationException
Description copied from interface: WriterInterceptor
Interceptor method wrapping calls to MessageBodyWriter.writeTo(T, java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.OutputStream) method. The parameters of the wrapped method called are available from context. Implementations of this method SHOULD explicitly call WriterInterceptorContext.proceed() to invoke the next interceptor in the chain, and ultimately the wrapped MessageBodyWriter.writeTo method.

Specified by:
aroundWriteTo in interface WriterInterceptor
Parameters:
context - invocation context.
Throws:
IOException - if an IO error arises or is thrown by the wrapped MessageBodyWriter.writeTo method.
WebApplicationException - thrown by the wrapped MessageBodyWriter.writeTo method.


Copyright © 2007-2014, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.