javax.ws.rs.ext
Interface InterceptorContext<T>

Type Parameters:
T - Java type supported by corresponding message body provider
All Known Subinterfaces:
ReaderInterceptorContext<T>, WriterInterceptorContext<T>

public interface InterceptorContext<T>

Context shared by message body interceptors that can be used to wrap 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) and 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). The getters and setters in this context class correspond to the parameters in the aforementioned methods.

Since:
2.0
Author:
Santiago Pericas-Geertsen, Bill Burke
See Also:
ReaderInterceptor, WriterInterceptor, ReaderInterceptorContext, WriterInterceptorContext

Method Summary
 Annotation[] getAnnotations()
          Get annotations on the formal declaration of the resource method parameter that is the target of the message body conversion.
 Type getGenericType()
          Get the type of the object to be produced or written.
 MediaType getMediaType()
          Get media type of HTTP entity.
 Map<String,Object> getProperties()
          Get a mutable map of request-scoped properties that can be used for communication between different request/response processing components.
 Class<T> getType()
          Get Java type supported by corresponding message body provider.
 void setAnnotations(Annotation[] annotations)
          Update annotations on the formal declaration of the resource method parameter that is the target of the message body conversion.
 void setGenericType(Type genericType)
          Update type of the object to be produced or written.
 void setMediaType(MediaType mediaType)
          Update media type of HTTP entity.
 void setType(Class<T> type)
          Update Java type before calling message body provider.
 

Method Detail

getProperties

Map<String,Object> getProperties()
Get a mutable map of request-scoped properties that can be used for communication between different request/response processing components. May be empty, but MUST never be null. In the scope of a single request/response processing, a same property map instance is shared by the following methods: A request-scoped property is an application-defined property that may be added, removed or modified by any of the components (user, filter, interceptor etc.) that participate in a given request/response processing flow.

On the client side, this property map is initialized by calling Configuration.setProperties(java.util.Map) or Configuration.setProperty(java.lang.String, java.lang.Object) on the configuration object associated with the corresponding request invocation.

On the server side, specifying the initial values is implementation-specific.

If there are no initial properties set, the request-scoped property map is initialized to an empty map.

Returns:
a mutable request-scoped property map.
See Also:
Configuration

getAnnotations

Annotation[] getAnnotations()
Get annotations on the formal declaration of the resource method parameter that is the target of the message body conversion. As part of the client API, this method will return null.

Returns:
annotations on the resource method parameter

setAnnotations

void setAnnotations(Annotation[] annotations)
Update annotations on the formal declaration of the resource method parameter that is the target of the message body conversion. Calling this method has no effect in the client API.

Parameters:
annotations - annotations for the resource method parameter

getType

Class<T> getType()
Get Java type supported by corresponding message body provider.

Returns:
java type supported by provider

setType

void setType(Class<T> type)
Update Java type before calling message body provider.

Parameters:
type - java type for provider

getGenericType

Type getGenericType()
Get the type of the object to be produced or written.

Returns:
type of object produced or written

setGenericType

void setGenericType(Type genericType)
Update type of the object to be produced or written.

Parameters:
genericType - new type for object

getMediaType

MediaType getMediaType()
Get media type of HTTP entity.

Returns:
media type of HTTP entity

setMediaType

void setMediaType(MediaType mediaType)
Update media type of HTTP entity.

Parameters:
mediaType - new type for HTTP entity


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