org.jboss.resteasy.spi
Class ResteasyProviderFactory

java.lang.Object
  extended by javax.ws.rs.ext.RuntimeDelegate
      extended by org.jboss.resteasy.spi.ResteasyProviderFactory
All Implemented Interfaces:
Providers
Direct Known Subclasses:
ThreadLocalResteasyProviderFactory

public class ResteasyProviderFactory
extends RuntimeDelegate
implements Providers

Version:
$Revision: 1 $
Author:
Bill Burke

Nested Class Summary
protected static class ResteasyProviderFactory.SortedKey<T>
          Allow us to sort message body implementations that are more specific for their types i.e.
 
Nested classes/interfaces inherited from class javax.ws.rs.ext.RuntimeDelegate
RuntimeDelegate.HeaderDelegate<T>
 
Field Summary
protected  boolean builtinsRegistered
           
protected  java.util.List<ClientErrorInterceptor> clientErrorInterceptors
           
protected  InterceptorRegistry<ClientExecutionInterceptor> clientExecutionInterceptorRegistry
           
protected  InterceptorRegistry<MessageBodyReaderInterceptor> clientMessageBodyReaderInterceptorRegistry
           
protected  InterceptorRegistry<MessageBodyWriterInterceptor> clientMessageBodyWriterInterceptorRegistry
           
protected  java.util.Map<java.lang.Class<?>,MediaTypeMap<ResteasyProviderFactory.SortedKey<ContextResolver>>> contextResolvers
           
protected static ThreadLocalStack<java.util.Map<java.lang.Class<?>,java.lang.Object>> contextualData
           
protected  java.util.Map<java.lang.Class<?>,ExceptionMapper> exceptionMappers
           
protected  java.util.Map<java.lang.Class<?>,RuntimeDelegate.HeaderDelegate> headerDelegates
           
protected  InjectorFactory injectorFactory
           
protected static int maxForwards
           
protected  MediaTypeMap<ResteasyProviderFactory.SortedKey<MessageBodyReader>> messageBodyReaders
           
protected  MediaTypeMap<ResteasyProviderFactory.SortedKey<MessageBodyWriter>> messageBodyWriters
           
protected static java.util.concurrent.atomic.AtomicReference<ResteasyProviderFactory> pfr
           
protected  java.util.Map<java.lang.Class<?>,java.lang.Object> providers
           
static boolean registerBuiltinByDefault
           
protected  boolean registerBuiltins
           
protected  InterceptorRegistry<MessageBodyReaderInterceptor> serverMessageBodyReaderInterceptorRegistry
           
protected  InterceptorRegistry<MessageBodyWriterInterceptor> serverMessageBodyWriterInterceptorRegistry
           
protected  InterceptorRegistry<PostProcessInterceptor> serverPostProcessInterceptorRegistry
           
protected  InterceptorRegistry<PreProcessInterceptor> serverPreProcessInterceptorRegistry
           
protected  java.util.Map<java.lang.Class<?>,StringConverter> stringConverters
           
protected  java.util.Map<java.lang.Class<?>,java.lang.Class<? extends StringParameterUnmarshaller>> stringParameterUnmarshallers
           
 
Fields inherited from class javax.ws.rs.ext.RuntimeDelegate
JAXRS_RUNTIME_DELEGATE_PROPERTY
 
Constructor Summary
ResteasyProviderFactory()
           
 
Method Summary
 void addBuiltInMessageBodyReader(MessageBodyReader provider)
           
 void addBuiltInMessageBodyWriter(MessageBodyWriter provider)
           
 void addClientErrorInterceptor(ClientErrorInterceptor handler)
          Add a ClientErrorInterceptor to this provider factory instance.
static java.util.Map<java.lang.Class<?>,java.lang.Object> addContextDataLevel()
           
 void addContextResolver(java.lang.Class<? extends ContextResolver> resolver)
           
 void addContextResolver(java.lang.Class<? extends ContextResolver> resolver, boolean builtin)
           
 void addContextResolver(ContextResolver provider)
           
 void addContextResolver(ContextResolver provider, boolean builtin)
           
 void addContextResolver(ContextResolver provider, java.lang.reflect.Type typeParameter)
           
 void addContextResolver(ContextResolver provider, java.lang.reflect.Type typeParameter, boolean builtin)
           
 void addExceptionMapper(java.lang.Class<? extends ExceptionMapper> provider)
           
 void addExceptionMapper(ExceptionMapper provider)
           
 void addExceptionMapper(ExceptionMapper provider, java.lang.reflect.Type exceptionType)
           
 void addHeaderDelegate(java.lang.Class clazz, RuntimeDelegate.HeaderDelegate header)
           
 void addMessageBodyReader(java.lang.Class<? extends MessageBodyReader> provider)
           
 void addMessageBodyReader(java.lang.Class<? extends MessageBodyReader> provider, boolean isBuiltin)
           
 void addMessageBodyReader(MessageBodyReader provider)
           
 void addMessageBodyReader(MessageBodyReader provider, boolean isBuiltin)
           
 void addMessageBodyWriter(java.lang.Class<? extends MessageBodyWriter> provider)
           
 void addMessageBodyWriter(java.lang.Class<? extends MessageBodyWriter> provider, boolean isBuiltin)
           
 void addMessageBodyWriter(MessageBodyWriter provider)
           
 void addMessageBodyWriter(MessageBodyWriter provider, boolean isBuiltin)
           
 void addStringConverter(java.lang.Class<? extends StringConverter> resolver)
           
 void addStringConverter(StringConverter provider)
           
 void addStringConverter(StringConverter provider, java.lang.reflect.Type typeParameter)
           
 void addStringParameterUnmarshaller(java.lang.Class<? extends StringParameterUnmarshaller> provider)
           
 void appendInterceptorPrecedence(java.lang.String precedence)
          Append interceptor predence
static void clearContextData()
           
<T> T
createEndpoint(Application applicationConfig, java.lang.Class<T> endpointType)
          this is a spec method that is unsupported.
<T> RuntimeDelegate.HeaderDelegate<T>
createHeaderDelegate(java.lang.Class<T> tClass)
          Obtain an instance of a HeaderDelegate for the supplied class.
 Response.ResponseBuilder createResponseBuilder()
          Create a new instance of a Response.ResponseBuilder.
<T> StringParameterUnmarshaller<T>
createStringParameterUnmarshaller(java.lang.Class<T> clazz)
           
 UriBuilder createUriBuilder()
          Create a new instance of a UriBuilder.
 Variant.VariantListBuilder createVariantListBuilder()
          Create a new instance of a Variant.VariantListBuilder.
 java.util.List<ClientErrorInterceptor> getClientErrorInterceptors()
          Return the list of currently registered ClientErrorInterceptor instances.
 InterceptorRegistry<ClientExecutionInterceptor> getClientExecutionInterceptorRegistry()
           
 InterceptorRegistry<MessageBodyReaderInterceptor> getClientMessageBodyReaderInterceptorRegistry()
           
 InterceptorRegistry<MessageBodyWriterInterceptor> getClientMessageBodyWriterInterceptorRegistry()
           
static
<T> T
getContextData(java.lang.Class<T> type)
           
static int getContextDataLevelCount()
           
static java.util.Map<java.lang.Class<?>,java.lang.Object> getContextDataMap()
           
<T> ContextResolver<T>
getContextResolver(java.lang.Class<T> contextType, MediaType mediaType)
          Get a context resolver for a particular type of context and media type.
 java.util.List<ContextResolver> getContextResolvers(java.lang.Class<?> clazz, MediaType type)
           
<T extends java.lang.Throwable>
ExceptionMapper<T>
getExceptionMapper(java.lang.Class<T> type)
          Get an exception mapping provider for a particular class of exception.
 InjectorFactory getInjectorFactory()
           
static ResteasyProviderFactory getInstance()
           
<T> MessageBodyReader<T>
getMessageBodyReader(java.lang.Class<T> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, MediaType mediaType)
          Get a message body reader that matches a set of criteria.
<T> MessageBodyWriter<T>
getMessageBodyWriter(java.lang.Class<T> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, MediaType mediaType)
          Get a message body writer that matches a set of criteria.
<T> T
getProvider(java.lang.Class<T> providerClass)
          Obtain a registered @Provider instance keyed by class.
protected
<T> T
getProviderInstance(java.lang.Class<? extends T> clazz)
           
 InterceptorRegistry<MessageBodyReaderInterceptor> getServerMessageBodyReaderInterceptorRegistry()
           
 InterceptorRegistry<MessageBodyWriterInterceptor> getServerMessageBodyWriterInterceptorRegistry()
           
 InterceptorRegistry<PostProcessInterceptor> getServerPostProcessInterceptorRegistry()
           
 InterceptorRegistry<PreProcessInterceptor> getServerPreProcessInterceptorRegistry()
           
 StringConverter getStringConverter(java.lang.Class<?> clazz)
           
protected  void initialize()
           
 void injectProperties(java.lang.Object o)
           
 void insertInterceptorPrecedenceAfter(java.lang.String after, java.lang.String newPrecedence)
           
 void insertInterceptorPrecedenceBefore(java.lang.String before, java.lang.String newPrecedence)
           
 boolean isBuiltinsRegistered()
           
 boolean isRegisterBuiltins()
           
static
<T> T
popContextData(java.lang.Class<T> type)
           
static
<T> void
pushContext(java.lang.Class<T> type, T data)
           
static void pushContextDataMap(java.util.Map<java.lang.Class<?>,java.lang.Object> map)
           
protected  void registerDefaultInterceptorPrecedences()
           
protected  void registerDefaultInterceptorPrecedences(InterceptorRegistry registry)
           
 void registerProvider(java.lang.Class provider)
           
 void registerProvider(java.lang.Class provider, boolean isBuiltin)
          Register a @Provider class.
 void registerProviderInstance(java.lang.Object provider)
          Register a @Provider object.
static void removeContextDataLevel()
           
 void setBuiltinsRegistered(boolean builtinsRegistered)
           
 void setInjectorFactory(InjectorFactory injectorFactory)
           
static void setInstance(ResteasyProviderFactory factory)
           
static void setRegisterBuiltinByDefault(boolean registerBuiltinByDefault)
           
 void setRegisterBuiltins(boolean registerBuiltins)
           
 
Methods inherited from class javax.ws.rs.ext.RuntimeDelegate
setInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messageBodyReaders

protected MediaTypeMap<ResteasyProviderFactory.SortedKey<MessageBodyReader>> messageBodyReaders

messageBodyWriters

protected MediaTypeMap<ResteasyProviderFactory.SortedKey<MessageBodyWriter>> messageBodyWriters

exceptionMappers

protected java.util.Map<java.lang.Class<?>,ExceptionMapper> exceptionMappers

providers

protected java.util.Map<java.lang.Class<?>,java.lang.Object> providers

contextResolvers

protected java.util.Map<java.lang.Class<?>,MediaTypeMap<ResteasyProviderFactory.SortedKey<ContextResolver>>> contextResolvers

stringConverters

protected java.util.Map<java.lang.Class<?>,StringConverter> stringConverters

stringParameterUnmarshallers

protected java.util.Map<java.lang.Class<?>,java.lang.Class<? extends StringParameterUnmarshaller>> stringParameterUnmarshallers

headerDelegates

protected java.util.Map<java.lang.Class<?>,RuntimeDelegate.HeaderDelegate> headerDelegates

pfr

protected static java.util.concurrent.atomic.AtomicReference<ResteasyProviderFactory> pfr

contextualData

protected static ThreadLocalStack<java.util.Map<java.lang.Class<?>,java.lang.Object>> contextualData

maxForwards

protected static int maxForwards

registerBuiltinByDefault

public static boolean registerBuiltinByDefault

serverMessageBodyReaderInterceptorRegistry

protected InterceptorRegistry<MessageBodyReaderInterceptor> serverMessageBodyReaderInterceptorRegistry

serverMessageBodyWriterInterceptorRegistry

protected InterceptorRegistry<MessageBodyWriterInterceptor> serverMessageBodyWriterInterceptorRegistry

serverPreProcessInterceptorRegistry

protected InterceptorRegistry<PreProcessInterceptor> serverPreProcessInterceptorRegistry

serverPostProcessInterceptorRegistry

protected InterceptorRegistry<PostProcessInterceptor> serverPostProcessInterceptorRegistry

clientMessageBodyReaderInterceptorRegistry

protected InterceptorRegistry<MessageBodyReaderInterceptor> clientMessageBodyReaderInterceptorRegistry

clientMessageBodyWriterInterceptorRegistry

protected InterceptorRegistry<MessageBodyWriterInterceptor> clientMessageBodyWriterInterceptorRegistry

clientExecutionInterceptorRegistry

protected InterceptorRegistry<ClientExecutionInterceptor> clientExecutionInterceptorRegistry

clientErrorInterceptors

protected java.util.List<ClientErrorInterceptor> clientErrorInterceptors

builtinsRegistered

protected boolean builtinsRegistered

registerBuiltins

protected boolean registerBuiltins

injectorFactory

protected InjectorFactory injectorFactory
Constructor Detail

ResteasyProviderFactory

public ResteasyProviderFactory()
Method Detail

registerDefaultInterceptorPrecedences

protected void registerDefaultInterceptorPrecedences(InterceptorRegistry registry)

registerDefaultInterceptorPrecedences

protected void registerDefaultInterceptorPrecedences()

appendInterceptorPrecedence

public void appendInterceptorPrecedence(java.lang.String precedence)
Append interceptor predence

Parameters:
precedence -

insertInterceptorPrecedenceAfter

public void insertInterceptorPrecedenceAfter(java.lang.String after,
                                             java.lang.String newPrecedence)
Parameters:
after - put newPrecedence after this
newPrecedence -

insertInterceptorPrecedenceBefore

public void insertInterceptorPrecedenceBefore(java.lang.String before,
                                              java.lang.String newPrecedence)
Parameters:
before - put newPrecedence before this
newPrecedence -

pushContext

public static <T> void pushContext(java.lang.Class<T> type,
                                   T data)

pushContextDataMap

public static void pushContextDataMap(java.util.Map<java.lang.Class<?>,java.lang.Object> map)

getContextDataMap

public static java.util.Map<java.lang.Class<?>,java.lang.Object> getContextDataMap()

getContextData

public static <T> T getContextData(java.lang.Class<T> type)

popContextData

public static <T> T popContextData(java.lang.Class<T> type)

clearContextData

public static void clearContextData()

addContextDataLevel

public static java.util.Map<java.lang.Class<?>,java.lang.Object> addContextDataLevel()

getContextDataLevelCount

public static int getContextDataLevelCount()

removeContextDataLevel

public static void removeContextDataLevel()

setInstance

public static void setInstance(ResteasyProviderFactory factory)

getInstance

public static ResteasyProviderFactory getInstance()

setRegisterBuiltinByDefault

public static void setRegisterBuiltinByDefault(boolean registerBuiltinByDefault)

initialize

protected void initialize()

isRegisterBuiltins

public boolean isRegisterBuiltins()

setRegisterBuiltins

public void setRegisterBuiltins(boolean registerBuiltins)

getInjectorFactory

public InjectorFactory getInjectorFactory()

setInjectorFactory

public void setInjectorFactory(InjectorFactory injectorFactory)

getServerMessageBodyReaderInterceptorRegistry

public InterceptorRegistry<MessageBodyReaderInterceptor> getServerMessageBodyReaderInterceptorRegistry()

getServerMessageBodyWriterInterceptorRegistry

public InterceptorRegistry<MessageBodyWriterInterceptor> getServerMessageBodyWriterInterceptorRegistry()

getServerPreProcessInterceptorRegistry

public InterceptorRegistry<PreProcessInterceptor> getServerPreProcessInterceptorRegistry()

getServerPostProcessInterceptorRegistry

public InterceptorRegistry<PostProcessInterceptor> getServerPostProcessInterceptorRegistry()

getClientMessageBodyReaderInterceptorRegistry

public InterceptorRegistry<MessageBodyReaderInterceptor> getClientMessageBodyReaderInterceptorRegistry()

getClientMessageBodyWriterInterceptorRegistry

public InterceptorRegistry<MessageBodyWriterInterceptor> getClientMessageBodyWriterInterceptorRegistry()

getClientExecutionInterceptorRegistry

public InterceptorRegistry<ClientExecutionInterceptor> getClientExecutionInterceptorRegistry()

isBuiltinsRegistered

public boolean isBuiltinsRegistered()

setBuiltinsRegistered

public void setBuiltinsRegistered(boolean builtinsRegistered)

createUriBuilder

public UriBuilder createUriBuilder()
Description copied from class: RuntimeDelegate
Create a new instance of a UriBuilder.

Specified by:
createUriBuilder in class RuntimeDelegate
Returns:
new UriBuilder instance
See Also:
UriBuilder

createResponseBuilder

public Response.ResponseBuilder createResponseBuilder()
Description copied from class: RuntimeDelegate
Create a new instance of a Response.ResponseBuilder.

Specified by:
createResponseBuilder in class RuntimeDelegate
Returns:
new ResponseBuilder instance
See Also:
Response.ResponseBuilder

createVariantListBuilder

public Variant.VariantListBuilder createVariantListBuilder()
Description copied from class: RuntimeDelegate
Create a new instance of a Variant.VariantListBuilder.

Specified by:
createVariantListBuilder in class RuntimeDelegate
Returns:
new VariantListBuilder instance
See Also:
Variant.VariantListBuilder

createHeaderDelegate

public <T> RuntimeDelegate.HeaderDelegate<T> createHeaderDelegate(java.lang.Class<T> tClass)
Description copied from class: RuntimeDelegate
Obtain an instance of a HeaderDelegate for the supplied class. An implementation is required to support the following values for type: Cookie, CacheControl, EntityTag, NewCookie, MediaType and java.util.Date.

Specified by:
createHeaderDelegate in class RuntimeDelegate
Parameters:
tClass - the class of the header
Returns:
an instance of HeaderDelegate for the supplied type

addHeaderDelegate

public void addHeaderDelegate(java.lang.Class clazz,
                              RuntimeDelegate.HeaderDelegate header)

addMessageBodyReader

public void addMessageBodyReader(java.lang.Class<? extends MessageBodyReader> provider)

addMessageBodyReader

public void addMessageBodyReader(java.lang.Class<? extends MessageBodyReader> provider,
                                 boolean isBuiltin)

addMessageBodyReader

public void addMessageBodyReader(MessageBodyReader provider)

addBuiltInMessageBodyReader

public void addBuiltInMessageBodyReader(MessageBodyReader provider)

addMessageBodyReader

public void addMessageBodyReader(MessageBodyReader provider,
                                 boolean isBuiltin)

addMessageBodyWriter

public void addMessageBodyWriter(java.lang.Class<? extends MessageBodyWriter> provider)

addMessageBodyWriter

public void addMessageBodyWriter(java.lang.Class<? extends MessageBodyWriter> provider,
                                 boolean isBuiltin)

addMessageBodyWriter

public void addMessageBodyWriter(MessageBodyWriter provider)

addBuiltInMessageBodyWriter

public void addBuiltInMessageBodyWriter(MessageBodyWriter provider)

addMessageBodyWriter

public void addMessageBodyWriter(MessageBodyWriter provider,
                                 boolean isBuiltin)

getMessageBodyReader

public <T> MessageBodyReader<T> getMessageBodyReader(java.lang.Class<T> type,
                                                     java.lang.reflect.Type genericType,
                                                     java.lang.annotation.Annotation[] annotations,
                                                     MediaType mediaType)
Description copied from interface: Providers
Get a message body reader that matches a set of criteria. The set of readers is first filtered by comparing the supplied value of mediaType with the value of each reader's Consumes, ensuring the supplied value of type is assignable to the generic type of the reader, and eliminating those that do not match. The list of matching readers is then ordered with those with the best matching values of Consumes (x/y > x/* > */*) sorted first. Finally, the MessageBodyReader.isReadable(java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType) method is called on each reader in order using the supplied criteria and the first reader that returns true is selected and returned.

Specified by:
getMessageBodyReader in interface Providers
Parameters:
type - the class of object that is to be read.
genericType - the type of object to be produced. E.g. if the message body is to be converted into a method parameter, this will be the formal type of the method parameter as returned by Class.getGenericParameterTypes.
annotations - an array of the annotations on the declaration of the artifact that will be initialized with the produced instance. E.g. if the message body is to be converted into a method parameter, this will be the annotations on that parameter returned by Class.getParameterAnnotations.
mediaType - the media type of the data that will be read.
Returns:
a MessageBodyReader that matches the supplied criteria or null if none is found.

addExceptionMapper

public void addExceptionMapper(java.lang.Class<? extends ExceptionMapper> provider)

addExceptionMapper

public void addExceptionMapper(ExceptionMapper provider)

addExceptionMapper

public void addExceptionMapper(ExceptionMapper provider,
                               java.lang.reflect.Type exceptionType)

addClientErrorInterceptor

public void addClientErrorInterceptor(ClientErrorInterceptor handler)
Add a ClientErrorInterceptor to this provider factory instance. Duplicate handlers are ignored. (For Client Proxy API only)


getClientErrorInterceptors

public java.util.List<ClientErrorInterceptor> getClientErrorInterceptors()
Return the list of currently registered ClientErrorInterceptor instances.


addContextResolver

public void addContextResolver(java.lang.Class<? extends ContextResolver> resolver)

addContextResolver

public void addContextResolver(java.lang.Class<? extends ContextResolver> resolver,
                               boolean builtin)

addContextResolver

public void addContextResolver(ContextResolver provider)

addContextResolver

public void addContextResolver(ContextResolver provider,
                               boolean builtin)

addContextResolver

public void addContextResolver(ContextResolver provider,
                               java.lang.reflect.Type typeParameter)

addContextResolver

public void addContextResolver(ContextResolver provider,
                               java.lang.reflect.Type typeParameter,
                               boolean builtin)

injectProperties

public void injectProperties(java.lang.Object o)

addStringConverter

public void addStringConverter(java.lang.Class<? extends StringConverter> resolver)

addStringConverter

public void addStringConverter(StringConverter provider)

addStringConverter

public void addStringConverter(StringConverter provider,
                               java.lang.reflect.Type typeParameter)

addStringParameterUnmarshaller

public void addStringParameterUnmarshaller(java.lang.Class<? extends StringParameterUnmarshaller> provider)

getContextResolvers

public java.util.List<ContextResolver> getContextResolvers(java.lang.Class<?> clazz,
                                                           MediaType type)

getStringConverter

public StringConverter getStringConverter(java.lang.Class<?> clazz)

createStringParameterUnmarshaller

public <T> StringParameterUnmarshaller<T> createStringParameterUnmarshaller(java.lang.Class<T> clazz)

registerProvider

public void registerProvider(java.lang.Class provider)

registerProvider

public void registerProvider(java.lang.Class provider,
                             boolean isBuiltin)
Register a @Provider class. Can be a MessageBodyReader/Writer or ExceptionMapper.

Parameters:
provider -

registerProviderInstance

public void registerProviderInstance(java.lang.Object provider)
Register a @Provider object. Can be a MessageBodyReader/Writer or ExceptionMapper.

Parameters:
provider -

getProvider

public <T> T getProvider(java.lang.Class<T> providerClass)
Obtain a registered @Provider instance keyed by class. This can get you access to any @Provider: MessageBodyReader/Writer or ExceptionMapper


getExceptionMapper

public <T extends java.lang.Throwable> ExceptionMapper<T> getExceptionMapper(java.lang.Class<T> type)
Description copied from interface: Providers
Get an exception mapping provider for a particular class of exception. Returns the provider whose generic type is the nearest superclass of type.

Specified by:
getExceptionMapper in interface Providers
Parameters:
type - the class of exception
Returns:
an ExceptionMapper for the supplied type or null if none is found.

getMessageBodyWriter

public <T> MessageBodyWriter<T> getMessageBodyWriter(java.lang.Class<T> type,
                                                     java.lang.reflect.Type genericType,
                                                     java.lang.annotation.Annotation[] annotations,
                                                     MediaType mediaType)
Description copied from interface: Providers
Get a message body writer that matches a set of criteria. The set of writers is first filtered by comparing the supplied value of mediaType with the value of each writer's Produces, ensuring the supplied value of type is assignable to the generic type of the reader, and eliminating those that do not match. The list of matching writers is then ordered with those with the best matching values of Produces (x/y > x/* > */*) sorted first. Finally, the MessageBodyWriter.isWriteable(java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType) method is called on each writer in order using the supplied criteria and the first writer that returns true is selected and returned.

Specified by:
getMessageBodyWriter in interface Providers
Parameters:
type - the class of object that is to be written.
genericType - the type of object to be written. E.g. if the message body is to be produced from a field, this will be the declared type of the field as returned by Field.getGenericType.
annotations - an array of the annotations on the declaration of the artifact that will be written. E.g. if the message body is to be produced from a field, this will be the annotations on that field returned by Field.getDeclaredAnnotations.
mediaType - the media type of the data that will be written.
Returns:
a MessageBodyReader that matches the supplied criteria or null if none is found.

createEndpoint

public <T> T createEndpoint(Application applicationConfig,
                            java.lang.Class<T> endpointType)
                 throws java.lang.IllegalArgumentException,
                        java.lang.UnsupportedOperationException
this is a spec method that is unsupported. it is an optional method anyways.

Specified by:
createEndpoint in class RuntimeDelegate
Parameters:
applicationConfig -
endpointType -
Returns:
Throws:
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

getContextResolver

public <T> ContextResolver<T> getContextResolver(java.lang.Class<T> contextType,
                                                 MediaType mediaType)
Description copied from interface: Providers
Get a context resolver for a particular type of context and media type. The set of resolvers is first filtered by comparing the supplied value of mediaType with the value of each resolver's Produces, ensuring the generic type of the context resolver is assignable to the supplied value of contextType, and eliminating those that do not match. If only one resolver matches the criteria then it is returned. If more than one resolver matches then the list of matching resolvers is ordered with those with the best matching values of Produces (x/y > x/* > */*) sorted first. A proxy is returned that delegates calls to ContextResolver.getContext(java.lang.Class) to each matching context resolver in order and returns the first non-null value it obtains or null if all matching context resolvers return null.

Specified by:
getContextResolver in interface Providers
Parameters:
contextType - the class of context desired
mediaType - the media type of data for which a context is required.
Returns:
a matching context resolver instance or null if no matching context providers are found.

getProviderInstance

protected <T> T getProviderInstance(java.lang.Class<? extends T> clazz)


Copyright © 2010. All Rights Reserved.