- All Superinterfaces:
InterceptorContext
Context class used by
ReaderInterceptor
to intercept calls to (@link
jakarta.ws.rs.ext.MessageBodyReader#readFrom}. The getters and setters in this context class correspond to the
parameters of the intercepted method.- Since:
- 2.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionGet mutable map of HTTP headers.Get the input stream of the object to be read.proceed()
Proceed to the next interceptor in the chain.void
Set the input stream of the object to be read.Methods inherited from interface jakarta.ws.rs.ext.InterceptorContext
getAnnotations, getGenericType, getMediaType, getProperty, getPropertyNames, getType, hasProperty, removeProperty, setAnnotations, setGenericType, setMediaType, setProperty, setType
-
Method Details
-
proceed
Proceed to the next interceptor in the chain. Return the result of the next interceptor invoked. Interceptors MUST explicitly call this method to continue the execution chain; the call to this method in the last interceptor of the chain will invoke 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)
.- Returns:
- result of next interceptor invoked.
- Throws:
IOException
- if an IO error arises or is thrown by the wrappedMessageBodyReader.readFrom
method.WebApplicationException
- thrown by the wrappedMessageBodyReader.readFrom
method.
-
getInputStream
InputStream getInputStream()Get the input stream of the object to be read. The JAX-RS runtime is responsible for closing the input stream.- Returns:
- input stream of the object to be read.
-
setInputStream
Set the input stream of the object to be read. For example, by wrapping it with another input stream. The JAX-RS runtime is responsible for closing the input stream that is set.- Parameters:
is
- new input stream.
-
getHeaders
MultivaluedMap<String,String> getHeaders()Get mutable map of HTTP headers.Note that while the headers are mutable, a
reader interceptor
should typically roll-back any header modifications once the call tocontext.proceed()
returns, to avoid externally visible side-effects of the interceptor invocation.- Returns:
- map of HTTP headers.
-