public abstract class AbstractReaderInterceptorContext extends Object implements ReaderInterceptorContext
Modifier and Type | Field and Description |
---|---|
protected Annotation[] |
annotations |
protected Type |
genericType |
protected MultivaluedMap<String,String> |
headers |
protected int |
index |
protected InputStream |
inputStream |
protected ReaderInterceptor[] |
interceptors |
protected MediaType |
mediaType |
protected ResteasyProviderFactory |
providerFactory |
protected Class |
type |
Constructor and Description |
---|
AbstractReaderInterceptorContext(MediaType mediaType,
ResteasyProviderFactory providerFactory,
Annotation[] annotations,
ReaderInterceptor[] interceptors,
MultivaluedMap<String,String> headers,
Type genericType,
Class type,
InputStream inputStream) |
Modifier and Type | Method and Description |
---|---|
Annotation[] |
getAnnotations()
Get an array of the annotations formally declared on the artifact that
initiated the intercepted entity provider invocation.
|
Type |
getGenericType()
Get the type of the object to be produced or written.
|
MultivaluedMap<String,String> |
getHeaders()
Get mutable map of HTTP headers.
|
InputStream |
getInputStream()
Get the input stream of the object to be read.
|
MediaType |
getMediaType()
Get media type of HTTP entity.
|
protected MessageBodyReader |
getReader() |
Class |
getType()
Get Java type supported by corresponding message body provider.
|
Object |
proceed()
Proceed to the next interceptor in the chain.
|
protected Object |
readFrom(MessageBodyReader reader) |
protected abstract MessageBodyReader |
resolveReader(MediaType mediaType) |
void |
setAnnotations(Annotation[] annotations)
Update annotations on the formal declaration of the artifact that
initiated the intercepted entity provider invocation.
|
void |
setGenericType(Type genericType)
Update type of the object to be produced or written.
|
void |
setInputStream(InputStream is)
Set the input stream of the object to be read.
|
void |
setMediaType(MediaType mediaType)
Update media type of HTTP entity.
|
void |
setType(Class type)
Update Java type before calling message body provider.
|
protected abstract void |
throwReaderNotFound() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getProperty, getPropertyNames, removeProperty, setProperty
protected ReaderInterceptor[] interceptors
protected ResteasyProviderFactory providerFactory
protected Class type
protected Type genericType
protected Annotation[] annotations
protected MediaType mediaType
protected MultivaluedMap<String,String> headers
protected InputStream inputStream
protected int index
public AbstractReaderInterceptorContext(MediaType mediaType, ResteasyProviderFactory providerFactory, Annotation[] annotations, ReaderInterceptor[] interceptors, MultivaluedMap<String,String> headers, Type genericType, Class type, InputStream inputStream)
public Object proceed() throws IOException
ReaderInterceptorContext
MessageBodyReader.readFrom(java.lang.Class<T>, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String, java.lang.String>, java.io.InputStream)
.proceed
in interface ReaderInterceptorContext
IOException
- if an IO error arises or is
thrown by the wrapped MessageBodyReader.readFrom
method.protected Object readFrom(MessageBodyReader reader) throws IOException
IOException
protected MessageBodyReader getReader()
protected abstract MessageBodyReader resolveReader(MediaType mediaType)
protected abstract void throwReaderNotFound()
public InputStream getInputStream()
ReaderInterceptorContext
getInputStream
in interface ReaderInterceptorContext
public void setInputStream(InputStream is)
ReaderInterceptorContext
setInputStream
in interface ReaderInterceptorContext
is
- new input stream.public MultivaluedMap<String,String> getHeaders()
ReaderInterceptorContext
Note that while the headers are mutable, a reader interceptor
should typically roll-back any header modifications once the call to context.proceed()
returns, to avoid externally visible side-effects of the interceptor
invocation.
getHeaders
in interface ReaderInterceptorContext
public Annotation[] getAnnotations()
InterceptorContext
Method.getParameterAnnotations()
;
if the server-side response entity instance is to be converted into an
output stream, this will be the annotations on the matched resource method
returned by Method.getAnnotations()
.
This method may return an empty array in case the interceptor is
not invoked in a context of any particular resource method
(e.g. as part of the client API), but will never return null
.getAnnotations
in interface InterceptorContext
public void setAnnotations(Annotation[] annotations)
InterceptorContext
setAnnotations
in interface InterceptorContext
annotations
- updated annotations declarataion of the artifact that
initiated the intercepted entity provider invocation.
Must not be null
.public Class getType()
InterceptorContext
getType
in interface InterceptorContext
public void setType(Class type)
InterceptorContext
setType
in interface InterceptorContext
type
- java type for providerpublic Type getGenericType()
InterceptorContext
getGenericType
in interface InterceptorContext
public void setGenericType(Type genericType)
InterceptorContext
setGenericType
in interface InterceptorContext
genericType
- new type for objectpublic MediaType getMediaType()
InterceptorContext
getMediaType
in interface InterceptorContext
public void setMediaType(MediaType mediaType)
InterceptorContext
setMediaType
in interface InterceptorContext
mediaType
- new type for HTTP entityCopyright © 2021 JBoss by Red Hat. All rights reserved.