Class MappableExceptionWrapperInterceptor
- java.lang.Object
-
- org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor
-
- All Implemented Interfaces:
ReaderInterceptor,WriterInterceptor
@Priority(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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMappableExceptionWrapperInterceptor.BinderBinder registering theException Wrapper Interceptor(used on the client side).
-
Constructor Summary
Constructors Constructor Description MappableExceptionWrapperInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectaroundReadFrom(ReaderInterceptorContext context)voidaroundWriteTo(WriterInterceptorContext context)
-
-
-
Method Detail
-
aroundReadFrom
public Object aroundReadFrom(ReaderInterceptorContext context) throws IOException, WebApplicationException
Description copied from interface:ReaderInterceptorInterceptor method wrapping calls toMessageBodyReader.readFrom(java.lang.Class<T>, java.lang.reflect.Type, java.lang.annotation.Annotation[], jakarta.ws.rs.core.MediaType, jakarta.ws.rs.core.MultivaluedMap<java.lang.String, java.lang.String>, java.io.InputStream)method. The parameters of the wrapped method called are available fromcontext. Implementations of this method SHOULD explicitly callReaderInterceptorContext.proceed()to invoke the next interceptor in the chain, and ultimately the wrappedMessageBodyReader.readFrom(java.lang.Class<T>, java.lang.reflect.Type, java.lang.annotation.Annotation[], jakarta.ws.rs.core.MediaType, jakarta.ws.rs.core.MultivaluedMap<java.lang.String, java.lang.String>, java.io.InputStream)method.- Specified by:
aroundReadFromin interfaceReaderInterceptor- 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 wrappedMessageBodyReader.readFrommethod.WebApplicationException- thrown by the wrappedMessageBodyReader.readFrommethod.
-
aroundWriteTo
public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException
Description copied from interface:WriterInterceptorInterceptor method wrapping calls toMessageBodyWriter.writeTo(T, java.lang.Class<?>, java.lang.reflect.Type, java.lang.annotation.Annotation[], jakarta.ws.rs.core.MediaType, jakarta.ws.rs.core.MultivaluedMap<java.lang.String, java.lang.Object>, java.io.OutputStream)method. The parameters of the wrapped method called are available fromcontext. Implementations of this method SHOULD explicitly callWriterInterceptorContext.proceed()to invoke the next interceptor in the chain, and ultimately the wrappedMessageBodyWriter.writeTomethod.- Specified by:
aroundWriteToin interfaceWriterInterceptor- Parameters:
context- invocation context.- Throws:
IOException- if an IO error arises or is thrown by the wrappedMessageBodyWriter.writeTomethod.WebApplicationException- thrown by the wrappedMessageBodyWriter.writeTomethod.
-
-