|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.ws.rs.ext.RuntimeDelegate org.jboss.resteasy.spi.ResteasyProviderFactory org.jboss.resteasy.core.ThreadLocalResteasyProviderFactory
public class ThreadLocalResteasyProviderFactory
Allow applications to push/pop provider factories onto the stack
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.jboss.resteasy.spi.ResteasyProviderFactory |
---|
ResteasyProviderFactory.SortedKey<T> |
Nested classes/interfaces inherited from class javax.ws.rs.ext.RuntimeDelegate |
---|
RuntimeDelegate.HeaderDelegate<T> |
Field Summary |
---|
Fields inherited from class javax.ws.rs.ext.RuntimeDelegate |
---|
JAXRS_RUNTIME_DELEGATE_PROPERTY |
Constructor Summary | |
---|---|
ThreadLocalResteasyProviderFactory(ResteasyProviderFactory defaultFactory)
|
Method Summary | ||
---|---|---|
void |
addBuiltInMessageBodyReader(MessageBodyReader provider)
|
|
void |
addBuiltInMessageBodyWriter(MessageBodyWriter provider)
|
|
void |
addClientErrorInterceptor(ClientErrorInterceptor handler)
Add a ClientErrorInterceptor to this provider factory instance. |
|
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> resolver)
|
|
void |
appendInterceptorPrecedence(java.lang.String precedence)
Append interceptor predence |
|
|
createEndpoint(Application applicationConfig,
java.lang.Class<T> endpointType)
this is a spec method that is unsupported. |
|
|
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 . |
|
|
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()
|
|
|
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)
|
|
ResteasyProviderFactory |
getDelegate()
|
|
|
getExceptionMapper(java.lang.Class<T> type)
Get an exception mapping provider for a particular class of exception. |
|
InjectorFactory |
getInjectorFactory()
|
|
|
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. |
|
|
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. |
|
|
getProvider(java.lang.Class<T> providerClass)
Obtain a registered @Provider instance keyed by class. |
|
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 void |
pop()
|
|
static void |
push(ResteasyProviderFactory factory)
|
|
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. |
|
void |
setBuiltinsRegistered(boolean builtinsRegistered)
|
|
void |
setInjectorFactory(InjectorFactory injectorFactory)
|
|
void |
setRegisterBuiltins(boolean registerBuiltins)
|
Methods inherited from class org.jboss.resteasy.spi.ResteasyProviderFactory |
---|
addContextDataLevel, clearContextData, getContextData, getContextDataLevelCount, getContextDataMap, getInstance, getProviderInstance, popContextData, pushContext, pushContextDataMap, registerDefaultInterceptorPrecedences, registerDefaultInterceptorPrecedences, removeContextDataLevel, setInstance, setRegisterBuiltinByDefault |
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 |
Constructor Detail |
---|
public ThreadLocalResteasyProviderFactory(ResteasyProviderFactory defaultFactory)
Method Detail |
---|
public ResteasyProviderFactory getDelegate()
getDelegate
in interface ProviderFactoryDelegate
public void addExceptionMapper(ExceptionMapper provider, java.lang.reflect.Type exceptionType)
addExceptionMapper
in class ResteasyProviderFactory
public void addContextResolver(java.lang.Class<? extends ContextResolver> resolver, boolean builtin)
addContextResolver
in class ResteasyProviderFactory
public void addContextResolver(ContextResolver provider, boolean builtin)
addContextResolver
in class ResteasyProviderFactory
public void addContextResolver(ContextResolver provider, java.lang.reflect.Type typeParameter)
addContextResolver
in class ResteasyProviderFactory
public void addContextResolver(ContextResolver provider, java.lang.reflect.Type typeParameter, boolean builtin)
addContextResolver
in class ResteasyProviderFactory
public void addStringConverter(StringConverter provider, java.lang.reflect.Type typeParameter)
addStringConverter
in class ResteasyProviderFactory
public boolean isRegisterBuiltins()
isRegisterBuiltins
in class ResteasyProviderFactory
public void setRegisterBuiltins(boolean registerBuiltins)
setRegisterBuiltins
in class ResteasyProviderFactory
public InjectorFactory getInjectorFactory()
getInjectorFactory
in class ResteasyProviderFactory
public void setInjectorFactory(InjectorFactory injectorFactory)
setInjectorFactory
in class ResteasyProviderFactory
public void injectProperties(java.lang.Object o)
injectProperties
in class ResteasyProviderFactory
public void addStringParameterUnmarshaller(java.lang.Class<? extends StringParameterUnmarshaller> resolver)
addStringParameterUnmarshaller
in class ResteasyProviderFactory
public void addClientErrorInterceptor(ClientErrorInterceptor handler)
ResteasyProviderFactory
ClientErrorInterceptor
to this provider factory instance.
Duplicate handlers are ignored. (For Client Proxy API only)
addClientErrorInterceptor
in class ResteasyProviderFactory
public java.util.List<ClientErrorInterceptor> getClientErrorInterceptors()
ResteasyProviderFactory
ClientErrorInterceptor
instances.
getClientErrorInterceptors
in class ResteasyProviderFactory
public <T> StringParameterUnmarshaller<T> createStringParameterUnmarshaller(java.lang.Class<T> clazz)
createStringParameterUnmarshaller
in class ResteasyProviderFactory
public boolean isBuiltinsRegistered()
isBuiltinsRegistered
in class ResteasyProviderFactory
public void setBuiltinsRegistered(boolean builtinsRegistered)
setBuiltinsRegistered
in class ResteasyProviderFactory
public void addMessageBodyReader(MessageBodyReader provider, boolean isBuiltin)
addMessageBodyReader
in class ResteasyProviderFactory
public void addMessageBodyWriter(MessageBodyWriter provider, boolean isBuiltin)
addMessageBodyWriter
in class ResteasyProviderFactory
public InterceptorRegistry<MessageBodyReaderInterceptor> getServerMessageBodyReaderInterceptorRegistry()
getServerMessageBodyReaderInterceptorRegistry
in class ResteasyProviderFactory
public InterceptorRegistry<ClientExecutionInterceptor> getClientExecutionInterceptorRegistry()
getClientExecutionInterceptorRegistry
in class ResteasyProviderFactory
public InterceptorRegistry<MessageBodyWriterInterceptor> getClientMessageBodyWriterInterceptorRegistry()
getClientMessageBodyWriterInterceptorRegistry
in class ResteasyProviderFactory
public InterceptorRegistry<MessageBodyReaderInterceptor> getClientMessageBodyReaderInterceptorRegistry()
getClientMessageBodyReaderInterceptorRegistry
in class ResteasyProviderFactory
public InterceptorRegistry<PreProcessInterceptor> getServerPreProcessInterceptorRegistry()
getServerPreProcessInterceptorRegistry
in class ResteasyProviderFactory
public InterceptorRegistry<PostProcessInterceptor> getServerPostProcessInterceptorRegistry()
getServerPostProcessInterceptorRegistry
in class ResteasyProviderFactory
public InterceptorRegistry<MessageBodyWriterInterceptor> getServerMessageBodyWriterInterceptorRegistry()
getServerMessageBodyWriterInterceptorRegistry
in class ResteasyProviderFactory
protected void initialize()
initialize
in class ResteasyProviderFactory
public static void push(ResteasyProviderFactory factory)
public static void pop()
public UriBuilder createUriBuilder()
RuntimeDelegate
UriBuilder
.
createUriBuilder
in class ResteasyProviderFactory
UriBuilder
public Response.ResponseBuilder createResponseBuilder()
RuntimeDelegate
Response.ResponseBuilder
.
createResponseBuilder
in class ResteasyProviderFactory
Response.ResponseBuilder
public Variant.VariantListBuilder createVariantListBuilder()
RuntimeDelegate
Variant.VariantListBuilder
.
createVariantListBuilder
in class ResteasyProviderFactory
Variant.VariantListBuilder
public <T> RuntimeDelegate.HeaderDelegate<T> createHeaderDelegate(java.lang.Class<T> tClass)
RuntimeDelegate
Cookie
, CacheControl
,
EntityTag
, NewCookie
,
MediaType
and java.util.Date
.
createHeaderDelegate
in class ResteasyProviderFactory
tClass
- the class of the header
public void addHeaderDelegate(java.lang.Class clazz, RuntimeDelegate.HeaderDelegate header)
addHeaderDelegate
in class ResteasyProviderFactory
public void addMessageBodyReader(java.lang.Class<? extends MessageBodyReader> provider)
addMessageBodyReader
in class ResteasyProviderFactory
public void addMessageBodyReader(MessageBodyReader provider)
addMessageBodyReader
in class ResteasyProviderFactory
public void addBuiltInMessageBodyReader(MessageBodyReader provider)
addBuiltInMessageBodyReader
in class ResteasyProviderFactory
public void addMessageBodyWriter(java.lang.Class<? extends MessageBodyWriter> provider)
addMessageBodyWriter
in class ResteasyProviderFactory
public void addMessageBodyWriter(MessageBodyWriter provider)
addMessageBodyWriter
in class ResteasyProviderFactory
public void addBuiltInMessageBodyWriter(MessageBodyWriter provider)
addBuiltInMessageBodyWriter
in class ResteasyProviderFactory
public <T> MessageBodyReader<T> getMessageBodyReader(java.lang.Class<T> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, MediaType mediaType)
Providers
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.
getMessageBodyReader
in interface Providers
getMessageBodyReader
in class ResteasyProviderFactory
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.
public void addExceptionMapper(java.lang.Class<? extends ExceptionMapper> provider)
addExceptionMapper
in class ResteasyProviderFactory
public void addExceptionMapper(ExceptionMapper provider)
addExceptionMapper
in class ResteasyProviderFactory
public void addContextResolver(java.lang.Class<? extends ContextResolver> resolver)
addContextResolver
in class ResteasyProviderFactory
public void addContextResolver(ContextResolver provider)
addContextResolver
in class ResteasyProviderFactory
public void addStringConverter(java.lang.Class<? extends StringConverter> resolver)
addStringConverter
in class ResteasyProviderFactory
public void addStringConverter(StringConverter provider)
addStringConverter
in class ResteasyProviderFactory
public java.util.List<ContextResolver> getContextResolvers(java.lang.Class<?> clazz, MediaType type)
getContextResolvers
in class ResteasyProviderFactory
public StringConverter getStringConverter(java.lang.Class<?> clazz)
getStringConverter
in class ResteasyProviderFactory
public void registerProvider(java.lang.Class provider)
registerProvider
in class ResteasyProviderFactory
public void registerProviderInstance(java.lang.Object provider)
ResteasyProviderFactory
registerProviderInstance
in class ResteasyProviderFactory
public <T> T getProvider(java.lang.Class<T> providerClass)
ResteasyProviderFactory
getProvider
in class ResteasyProviderFactory
public <T extends java.lang.Throwable> ExceptionMapper<T> getExceptionMapper(java.lang.Class<T> type)
Providers
type
.
getExceptionMapper
in interface Providers
getExceptionMapper
in class ResteasyProviderFactory
type
- the class of exception
ExceptionMapper
for the supplied type or null if none
is found.public <T> MessageBodyWriter<T> getMessageBodyWriter(java.lang.Class<T> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, MediaType mediaType)
Providers
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.
getMessageBodyWriter
in interface Providers
getMessageBodyWriter
in class ResteasyProviderFactory
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.
public <T> T createEndpoint(Application applicationConfig, java.lang.Class<T> endpointType) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
ResteasyProviderFactory
createEndpoint
in class ResteasyProviderFactory
applicationConfig
- the application configurationendpointType
- the type of endpoint instance to be created.
java.lang.IllegalArgumentException
- if application is null or the
requested endpoint type is not supported.
java.lang.UnsupportedOperationException
- if the implementation
supports no endpoint types.public <T> ContextResolver<T> getContextResolver(java.lang.Class<T> contextType, MediaType mediaType)
Providers
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.
getContextResolver
in interface Providers
getContextResolver
in class ResteasyProviderFactory
contextType
- the class of context desiredmediaType
- the media type of data for which a context is required.
public void addMessageBodyReader(java.lang.Class<? extends MessageBodyReader> provider, boolean isBuiltin)
addMessageBodyReader
in class ResteasyProviderFactory
public void addMessageBodyWriter(java.lang.Class<? extends MessageBodyWriter> provider, boolean isBuiltin)
addMessageBodyWriter
in class ResteasyProviderFactory
public void registerProvider(java.lang.Class provider, boolean isBuiltin)
ResteasyProviderFactory
registerProvider
in class ResteasyProviderFactory
public void appendInterceptorPrecedence(java.lang.String precedence)
ResteasyProviderFactory
appendInterceptorPrecedence
in class ResteasyProviderFactory
public void insertInterceptorPrecedenceAfter(java.lang.String after, java.lang.String newPrecedence)
insertInterceptorPrecedenceAfter
in class ResteasyProviderFactory
after
- put newPrecedence after thispublic void insertInterceptorPrecedenceBefore(java.lang.String before, java.lang.String newPrecedence)
insertInterceptorPrecedenceBefore
in class ResteasyProviderFactory
before
- put newPrecedence before this
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |