public class ThreadLocalResteasyProviderFactory extends ResteasyProviderFactory implements ProviderFactoryDelegate
ResteasyProviderFactory.CloseableContext, ResteasyProviderFactory.ExtSortedKey<T>, ResteasyProviderFactory.SortedKey<T>
RuntimeDelegate.HeaderDelegate<T>
asyncClientResponseProviders, asyncResponseProviders, asyncStreamProviders, builtinsRegistered, classContracts, clientDynamicFeatures, clientErrorInterceptors, clientExceptionMappers, clientExecutionInterceptorRegistry, clientMessageBodyReaders, clientMessageBodyWriters, clientReaderInterceptorRegistry, clientRequestFilterRegistry, clientRequestFilters, clientResponseFilters, clientWriterInterceptorRegistry, containerRequestFilterRegistry, containerResponseFilterRegistry, contextResolvers, contextualData, enabledFeatures, exceptionMappers, featureClasses, featureInstances, headerDelegates, injectorFactory, instance, maxForwards, paramConverterProviders, parent, pfr, precedence, properties, providerClasses, providerInstances, reactiveClasses, registerBuiltinByDefault, registerBuiltins, resourceBuilder, serverDynamicFeatures, serverMessageBodyReaders, serverMessageBodyWriters, serverReaderInterceptorRegistry, serverWriterInterceptorRegistry, sortedExceptionMappers, sortedParamConverterProviders, stringConverters, stringParameterUnmarshallers
JAXRS_RUNTIME_DELEGATE_PROPERTY
Constructor and Description |
---|
ThreadLocalResteasyProviderFactory(ResteasyProviderFactory defaultFactory) |
Modifier and Type | Method and Description |
---|---|
void |
addClientErrorInterceptor(ClientErrorInterceptor handler)
Add a
ClientErrorInterceptor to this provider factory instance. |
void |
addClientExceptionMapper(Class<? extends ClientExceptionMapper<?>> providerClass) |
void |
addClientExceptionMapper(ClientExceptionMapper<?> provider) |
void |
addClientExceptionMapper(ClientExceptionMapper<?> provider,
Class<?> providerClass) |
void |
addClientExceptionMapper(ClientExceptionMapper<?> provider,
Type exceptionType) |
void |
addHeaderDelegate(Class clazz,
RuntimeDelegate.HeaderDelegate header) |
void |
addStringParameterUnmarshaller(Class<? extends StringParameterUnmarshaller> provider) |
void |
appendInterceptorPrecedence(String precedence)
Append interceptor predence.
|
<T> ConstructorInjector |
createConstructorInjector(Class<? extends T> clazz) |
<T> T |
createEndpoint(Application applicationConfig,
Class<T> endpointType)
This is a spec method that is unsupported.
|
<T> RuntimeDelegate.HeaderDelegate<T> |
createHeaderDelegate(Class<T> tClass)
Obtain an instance of a
RuntimeDelegate.HeaderDelegate for the supplied class. |
Link.Builder |
createLinkBuilder()
Create a new instance of a
Link.Builder . |
<T> T |
createProviderInstance(Class<? extends T> clazz)
Create an instance of a class using provider allocation rules of the specification as well as the InjectorFactory
only does constructor injection.
|
Response.ResponseBuilder |
createResponseBuilder()
Create a new instance of a
Response.ResponseBuilder . |
<T> StringParameterUnmarshaller<T> |
createStringParameterUnmarshaller(Class<T> clazz) |
UriBuilder |
createUriBuilder()
Create a new instance of a
UriBuilder . |
Variant.VariantListBuilder |
createVariantListBuilder()
Create a new instance of a
Variant.VariantListBuilder . |
<T> AsyncResponseProvider<T> |
getAsyncResponseProvider(Class<T> type) |
Map<Class<?>,AsyncResponseProvider> |
getAsyncResponseProviders() |
<T> AsyncStreamProvider<T> |
getAsyncStreamProvider(Class<T> type) |
Map<Class<?>,AsyncStreamProvider> |
getAsyncStreamProviders() |
Map<Class<?>,Map<Class<?>,Integer>> |
getClassContracts() |
Set<Class<?>> |
getClasses()
Get the immutable set of registered component (such as provider or
feature ) classes to be instantiated, injected and utilized in the scope
of the configurable instance. |
Set<DynamicFeature> |
getClientDynamicFeatures() |
List<ClientErrorInterceptor> |
getClientErrorInterceptors()
Return the list of currently registered
ClientErrorInterceptor instances. |
<T extends Throwable> |
getClientExceptionMapper(Class<T> type) |
InterceptorRegistry<ClientExecutionInterceptor> |
getClientExecutionInterceptorRegistry() |
<T> MessageBodyReader<T> |
getClientMessageBodyReader(Class<T> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType) |
<T> MessageBodyWriter<T> |
getClientMessageBodyWriter(Class<T> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType) |
ReaderInterceptorRegistry |
getClientReaderInterceptorRegistry() |
ClientRequestFilterRegistry |
getClientRequestFilterRegistry() |
JaxrsInterceptorRegistry<ClientRequestFilter> |
getClientRequestFilters()
Deprecated.
|
ClientResponseFilterRegistry |
getClientResponseFilters() |
WriterInterceptorRegistry |
getClientWriterInterceptorRegistry() |
MediaType |
getConcreteMediaTypeFromMessageBodyWriters(Class type,
Type genericType,
Annotation[] annotations,
MediaType mediaType) |
Configuration |
getConfiguration()
Get a live view of an internal configuration state of this configurable instance.
|
ContainerRequestFilterRegistry |
getContainerRequestFilterRegistry() |
ContainerResponseFilterRegistry |
getContainerResponseFilterRegistry() |
<T> ContextResolver<T> |
getContextResolver(Class<T> contextType,
MediaType mediaType)
Get a context resolver for a particular type of context and media type.
|
List<ContextResolver> |
getContextResolvers(Class<?> clazz,
MediaType type) |
Map<Class<?>,Integer> |
getContracts(Class<?> componentClass)
Get the extension contract registration information for a component of a given class.
|
ResteasyProviderFactory |
getDelegate() |
Collection<Feature> |
getEnabledFeatures() |
<T extends Throwable> |
getExceptionMapper(Class<T> type)
Get an exception mapping provider for a particular class of exception.
|
Map<Class<?>,ExceptionMapper> |
getExceptionMappers() |
Set<Class<?>> |
getFeatureClasses() |
Set<Object> |
getFeatureInstances() |
RuntimeDelegate.HeaderDelegate |
getHeaderDelegate(Class<?> aClass)
Checks to see if RuntimeDelegate is a ResteasyProviderFactory
If it is, then use that, otherwise use this.
|
InjectorFactory |
getInjectorFactory() |
Set<Object> |
getInstances()
Get the immutable set of registered component (such as provider or
feature ) instances to be utilized by the configurable instance. |
<T> MessageBodyReader<T> |
getMessageBodyReader(Class<T> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType)
Always returns server MBRs.
|
<T> MessageBodyWriter<T> |
getMessageBodyWriter(Class<T> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType)
Always gets server MBW.
|
Map<String,Object> |
getMutableProperties() |
ParamConverter |
getParamConverter(Class clazz,
Type genericType,
Annotation[] annotations) |
ResteasyProviderFactory |
getParent() |
Map<String,Object> |
getProperties()
Get the immutable bag of configuration properties.
|
Object |
getProperty(String name)
Get the value for the property with a given name.
|
Collection<String> |
getPropertyNames()
Returns an immutable
collection containing the
property names available within the context of the current configuration instance. |
Set<Class<?>> |
getProviderClasses()
Gets provide classes.
|
Set<Object> |
getProviderInstances()
Gets provider instances.
|
RuntimeType |
getRuntimeType()
Get the runtime type of this configuration context.
|
Set<DynamicFeature> |
getServerDynamicFeatures() |
<T> MessageBodyReader<T> |
getServerMessageBodyReader(Class<T> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType) |
<T> MessageBodyWriter<T> |
getServerMessageBodyWriter(Class<T> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType) |
ReaderInterceptorRegistry |
getServerReaderInterceptorRegistry() |
WriterInterceptorRegistry |
getServerWriterInterceptorRegistry() |
StringConverter |
getStringConverter(Class<?> clazz) |
protected void |
initialize() |
<T> T |
injectedInstance(Class<? extends T> clazz)
Property and constructor injection using the InjectorFactory.
|
<T> T |
injectedInstance(Class<? extends T> clazz,
HttpRequest request,
HttpResponse response)
Property and constructor injection using the InjectorFactory.
|
void |
injectProperties(Class declaring,
Object obj) |
void |
injectProperties(Object obj) |
void |
injectProperties(Object obj,
HttpRequest request,
HttpResponse response) |
void |
insertInterceptorPrecedenceAfter(String after,
String newPrecedence) |
void |
insertInterceptorPrecedenceBefore(String before,
String newPrecedence) |
boolean |
isBuiltinsRegistered() |
boolean |
isEnabled(Class<? extends Feature> featureClass)
Check if a
feature instance of featureClass class has been
previously enabled in the runtime configuration context. |
boolean |
isEnabled(Feature feature)
Check if a particular
feature instance has been previously
enabled in the runtime configuration context. |
boolean |
isRegisterBuiltins() |
boolean |
isRegistered(Class<?> componentClass)
Check if a component of the supplied
componentClass class has been previously
registered in the runtime configuration context. |
boolean |
isRegistered(Object component)
Check if a particular API
component instance (such as providers or
features ) has been previously registered in the runtime configuration context. |
static void |
pop() |
ResteasyProviderFactory |
property(String name,
Object value)
Set the new configuration property, if already set, the existing value of
the property will be updated.
|
static void |
push(ResteasyProviderFactory factory) |
ResteasyProviderFactory |
register(Class<?> providerClass)
Register a class of a custom component (such as an extension provider or
a
feature meta-provider) to be instantiated
and used in the scope of this configurable context. |
ResteasyProviderFactory |
register(Class<?> componentClass,
Class<?>... contracts)
Register a class of a custom component (such as an extension provider or
a
feature meta-provider) to be instantiated
and used in the scope of this configurable context. |
ResteasyProviderFactory |
register(Class<?> componentClass,
int priority)
Register a class of a custom component (such as an extension provider or
a
feature meta-provider) to be instantiated
and used in the scope of this configurable context. |
ResteasyProviderFactory |
register(Class<?> componentClass,
Map<Class<?>,Integer> contracts)
Register a class of a custom component (such as an extension provider or
a
feature meta-provider) to be instantiated
and used in the scope of this configurable context. |
ResteasyProviderFactory |
register(Object provider)
Register an instance of a custom component (such as an extension provider or
a
feature meta-provider) to be instantiated
and used in the scope of this configurable context. |
ResteasyProviderFactory |
register(Object component,
Class<?>... contracts)
Register an instance of a custom component (such as an extension provider or
a
feature meta-provider) to be instantiated
and used in the scope of this configurable context. |
ResteasyProviderFactory |
register(Object component,
int priority)
Register an instance of a custom component (such as an extension provider or
a
feature meta-provider) to be instantiated
and used in the scope of this configurable context. |
ResteasyProviderFactory |
register(Object component,
Map<Class<?>,Integer> contracts)
Register an instance of a custom component (such as an extension provider or
a
feature meta-provider) to be instantiated
and used in the scope of this configurable context. |
void |
registerProvider(Class provider) |
void |
registerProvider(Class provider,
boolean isBuiltin)
Register a @Provider class.
|
void |
registerProvider(Class provider,
Integer priorityOverride,
boolean isBuiltin,
Map<Class<?>,Integer> contracts) |
void |
registerProviderInstance(Object provider)
Register a @Provider object.
|
void |
registerProviderInstance(Object provider,
Map<Class<?>,Integer> contracts,
Integer defaultPriority,
boolean builtIn) |
void |
setBuiltinsRegistered(boolean builtinsRegistered) |
void |
setInjectorFactory(InjectorFactory injectorFactory) |
ResteasyProviderFactory |
setProperties(Map<String,?> properties) |
void |
setRegisterBuiltins(boolean registerBuiltins) |
String |
toHeaderString(Object object)
Convert an object to a header string.
|
String |
toString(Object object,
Class clazz,
Type genericType,
Annotation[] annotations)
Convert an object to a string.
|
addAsyncClientResponseProvider, addAsyncClientResponseProvider, addAsyncClientResponseProvider, addAsyncClientResponseProvider, addAsyncResponseProvider, addAsyncResponseProvider, addAsyncResponseProvider, addAsyncResponseProvider, addAsyncStreamProvider, addAsyncStreamProvider, addAsyncStreamProvider, addAsyncStreamProvider, addClientMessageBodyReader, addClientMessageBodyWriter, addCloseableContextDataLevel, addCloseableContextDataLevel, addContextDataLevel, addContextResolver, addContextResolver, addContextResolver, addContextResolver, addContextResolver, addContextResolver, addContextResolver, addContextResolver, addContextResolver, addContextResolver, addExceptionMapper, addExceptionMapper, addExceptionMapper, addExceptionMapper, addExceptionMapper, addExceptionMapper, addExceptionMapper, addExceptionMapper, addMessageBodyReader, addMessageBodyReader, addMessageBodyReader, addMessageBodyReader, addMessageBodyWriter, addMessageBodyWriter, addMessageBodyWriter, addResourceClassProcessor, addResourceClassProcessor, addServerMessageBodyReader, addServerMessageBodyWriter, addStringConverter, addStringConverter, addStringConverter, addStringConverter, clearContextData, clearInstanceIfEqual, createHeaderDelegateFromInterfaces, getAsyncClientResponseProvider, getAsyncClientResponseProviders, getClientExceptionMappers, getClientMessageBodyReaders, getClientMessageBodyWriters, getContextData, getContextDataLevelCount, getContextDataMap, getContextDataMap, getContextResolvers, getHeaderDelegates, getInstance, getParamConverterProviders, getPossibleMessageBodyWritersMap, getPrecedence, getPriority, getResourceBuilder, getRxInvokerProvider, getRxInvokerProviderFromReactiveClass, getServerMessageBodyReaders, getServerMessageBodyWriters, getSortedExceptionMappers, getSortedParamConverterProviders, getStatisticsController, getStringConverters, getStringParameterUnmarshallers, initialize, initializeClientProviders, isA, isA, isA, isA, isOnServer, isReactive, newInstance, peekInstance, popContextData, pushContext, pushContextDataMap, registerDefaultInterceptorPrecedences, registerDefaultInterceptorPrecedences, registerSingletonResource, removeContextDataLevel, resolveMessageBodyReader, resolveMessageBodyWriter, searchContextData, setInstance, setRegisterBuiltinByDefault
setInstance
public ThreadLocalResteasyProviderFactory(ResteasyProviderFactory defaultFactory)
public ResteasyProviderFactory getDelegate()
getDelegate
in interface ProviderFactoryDelegate
protected void initialize()
initialize
in class ResteasyProviderFactory
public MediaType getConcreteMediaTypeFromMessageBodyWriters(Class type, Type genericType, Annotation[] annotations, MediaType mediaType)
getConcreteMediaTypeFromMessageBodyWriters
in class ResteasyProviderFactory
public RuntimeDelegate.HeaderDelegate getHeaderDelegate(Class<?> aClass)
ResteasyProviderFactory
getHeaderDelegate
in class ResteasyProviderFactory
aClass
- class of the headerpublic <T> T injectedInstance(Class<? extends T> clazz, HttpRequest request, HttpResponse response)
ResteasyProviderFactory
injectedInstance
in class ResteasyProviderFactory
T
- typeclazz
- classrequest
- http requestresponse
- http responsepublic void injectProperties(Object obj, HttpRequest request, HttpResponse response)
injectProperties
in class ResteasyProviderFactory
public static void push(ResteasyProviderFactory factory)
public static void pop()
public ContainerResponseFilterRegistry getContainerResponseFilterRegistry()
getContainerResponseFilterRegistry
in class ResteasyProviderFactory
public ReaderInterceptorRegistry getServerReaderInterceptorRegistry()
getServerReaderInterceptorRegistry
in class ResteasyProviderFactory
public Variant.VariantListBuilder createVariantListBuilder()
RuntimeDelegate
Variant.VariantListBuilder
.createVariantListBuilder
in class ResteasyProviderFactory
VariantListBuilder
instance.Variant.VariantListBuilder
public List<ContextResolver> getContextResolvers(Class<?> clazz, MediaType type)
getContextResolvers
in class ResteasyProviderFactory
public boolean isBuiltinsRegistered()
isBuiltinsRegistered
in class ResteasyProviderFactory
public <T extends Throwable> ClientExceptionMapper<T> getClientExceptionMapper(Class<T> type)
getClientExceptionMapper
in class ResteasyProviderFactory
public Set<Class<?>> getFeatureClasses()
getFeatureClasses
in class ResteasyProviderFactory
public void setBuiltinsRegistered(boolean builtinsRegistered)
setBuiltinsRegistered
in class ResteasyProviderFactory
public ResteasyProviderFactory register(Class<?> providerClass)
Configurable
feature
meta-provider) to be instantiated
and used in the scope of this configurable context.
Implementations SHOULD warn about and ignore registrations that do not
conform to the requirements of supported component types in the
given configurable context. Any subsequent registration attempts for a component
type, for which a class or instance-based registration already exists in the system
MUST be rejected by the API implementation and a warning SHOULD be raised to
inform the user about the rejected registration.
The registered component class is registered as a contract provider of
all the recognized API or implementation-specific extension contracts including
meta-provider contracts, such as Feature
or DynamicFeature
.
As opposed to component instances registered via Configurable.register(Object)
method,
the lifecycle of components registered using this class-based register(...)
method is fully managed by the implementation or any underlying IoC
container supported by the implementation.
register
in interface Configurable<ResteasyProviderFactory>
register
in class ResteasyProviderFactory
providerClass
- component class to be configured in the scope of this
configurable context.public Set<DynamicFeature> getClientDynamicFeatures()
getClientDynamicFeatures
in class ResteasyProviderFactory
public void addClientExceptionMapper(Class<? extends ClientExceptionMapper<?>> providerClass)
addClientExceptionMapper
in class ResteasyProviderFactory
public ResteasyProviderFactory register(Class<?> componentClass, Map<Class<?>,Integer> contracts)
Configurable
feature
meta-provider) to be instantiated
and used in the scope of this configurable context.
This registration method provides same functionality as Configurable.register(Class, Class[])
except that any priority specified on the registered component class via
javax.annotation.Priority
annotation is overridden
for each extension provider contract type separately with an integer priority value
specified as a value in the supplied map of [contract type, priority] pairs.
Note that in case a priority is not applicable to a provider contract registered for the component, the supplied priority value is ignored for such contract.
register
in interface Configurable<ResteasyProviderFactory>
register
in class ResteasyProviderFactory
componentClass
- component class to be configured in the scope of this
configurable context.contracts
- map of the specific extension provider and meta-provider contracts
and their associated priorities for which the component
is registered.
All contracts in the map must represent a class or an interface
implemented or extended by the component. Contracts that are
not assignable from
the registered
component class MUST be ignored and implementations SHOULD raise a warning
to inform users about the ignored contract(s).public Collection<Feature> getEnabledFeatures()
getEnabledFeatures
in class ResteasyProviderFactory
public Response.ResponseBuilder createResponseBuilder()
RuntimeDelegate
Response.ResponseBuilder
.createResponseBuilder
in class ResteasyProviderFactory
ResponseBuilder
instance.Response.ResponseBuilder
public void registerProviderInstance(Object provider)
ResteasyProviderFactory
registerProviderInstance
in class ResteasyProviderFactory
provider
- provider instancepublic void addClientExceptionMapper(ClientExceptionMapper<?> provider, Type exceptionType)
addClientExceptionMapper
in class ResteasyProviderFactory
public StringConverter getStringConverter(Class<?> clazz)
getStringConverter
in class ResteasyProviderFactory
public <T> StringParameterUnmarshaller<T> createStringParameterUnmarshaller(Class<T> clazz)
createStringParameterUnmarshaller
in class ResteasyProviderFactory
public Set<Object> getFeatureInstances()
getFeatureInstances
in class ResteasyProviderFactory
public void addClientExceptionMapper(ClientExceptionMapper<?> provider)
addClientExceptionMapper
in class ResteasyProviderFactory
public void setInjectorFactory(InjectorFactory injectorFactory)
setInjectorFactory
in class ResteasyProviderFactory
public Set<Object> getInstances()
Configuration
feature
) instances to be utilized by the configurable instance.
Fields and properties of returned instances are injected with their declared dependencies
(see Context
) by the runtime prior to use.
For each component type, there can be only a single class-based or instance-based registration present in the configuration context at any given time.
getInstances
in interface Configuration
getInstances
in class ResteasyProviderFactory
null
.Configuration.getClasses()
public boolean isRegistered(Object component)
Configuration
component
instance (such as providers or
features
) has been previously registered in the runtime configuration context.
Method returns true
only in case an instance equal to the component
instance is already present among the components previously registered in the configuration
context.
isRegistered
in interface Configuration
isRegistered
in class ResteasyProviderFactory
component
- a component instance to test for.true
if the component instance has been previously registered in this
configuration context, false
otherwise.Configuration.isEnabled(Feature)
public ResteasyProviderFactory register(Class<?> componentClass, int priority)
Configurable
feature
meta-provider) to be instantiated
and used in the scope of this configurable context.
This registration method provides the same functionality as Configurable.register(Class)
except that any priority specified on the registered component class via
javax.annotation.Priority
annotation is overridden with the supplied
priority
value.
Note that in case the priority is not applicable to a particular
provider contract implemented by the class of the registered component, the supplied
priority
value will be ignored for that contract.
register
in interface Configurable<ResteasyProviderFactory>
register
in class ResteasyProviderFactory
componentClass
- component class to be configured in the scope of this
configurable context.priority
- the overriding priority for the registered component
and all the provider contracts the component implements.public <T> ContextResolver<T> getContextResolver(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
T
- type of the context.contextType
- the class of context desired.mediaType
- the media type of data for which a context is required.null
if no matching
context providers are found.public InterceptorRegistry<ClientExecutionInterceptor> getClientExecutionInterceptorRegistry()
getClientExecutionInterceptorRegistry
in class ResteasyProviderFactory
public <T> MessageBodyReader<T> getMessageBodyReader(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType)
ResteasyProviderFactory
getMessageBodyReader
in interface Providers
getMessageBodyReader
in class ResteasyProviderFactory
T
- typetype
- the class of the 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 addClientErrorInterceptor(ClientErrorInterceptor handler)
ResteasyProviderFactory
ClientErrorInterceptor
to this provider factory instance.
Duplicate handlers are ignored. (For Client Proxy API only)addClientErrorInterceptor
in class ResteasyProviderFactory
handler
- ClientErrorInterceptor handlerpublic void registerProvider(Class provider, Integer priorityOverride, boolean isBuiltin, Map<Class<?>,Integer> contracts)
registerProvider
in class ResteasyProviderFactory
public Map<Class<?>,Map<Class<?>,Integer>> getClassContracts()
getClassContracts
in class ResteasyProviderFactory
public ContainerRequestFilterRegistry getContainerRequestFilterRegistry()
getContainerRequestFilterRegistry
in class ResteasyProviderFactory
public ResteasyProviderFactory register(Object component, Map<Class<?>,Integer> contracts)
Configurable
feature
meta-provider) to be instantiated
and used in the scope of this configurable context.
This registration method provides same functionality as Configurable.register(Object, Class[])
except that any priority specified on the registered component class via
javax.annotation.Priority
annotation is overridden
for each extension provider contract type separately with an integer priority value
specified as a value in the supplied map of [contract type, priority] pairs.
Note that in case a priority is not applicable to a provider contract registered for the component, the supplied priority value is ignored for such contract.
register
in interface Configurable<ResteasyProviderFactory>
register
in class ResteasyProviderFactory
component
- component instance to be configured in the scope of this
configurable context.contracts
- map of the specific extension provider and meta-provider contracts
and their associated priorities for which the component
is registered.
All contracts in the map must represent a class or an interface
implemented or extended by the component. Contracts that are
not assignable from
the registered
component class MUST be ignored and implementations SHOULD raise a warning
to inform users about the ignored contract(s).public boolean isRegisterBuiltins()
isRegisterBuiltins
in class ResteasyProviderFactory
public ReaderInterceptorRegistry getClientReaderInterceptorRegistry()
getClientReaderInterceptorRegistry
in class ResteasyProviderFactory
public void setRegisterBuiltins(boolean registerBuiltins)
setRegisterBuiltins
in class ResteasyProviderFactory
public ResteasyProviderFactory register(Object component, int priority)
Configurable
feature
meta-provider) to be instantiated
and used in the scope of this configurable context.
This registration method provides the same functionality as Configurable.register(Object)
except that any priority specified on the registered component class via
javax.annotation.Priority
annotation is overridden with the supplied
priority
value.
Note that in case the priority is not applicable to a particular
provider contract implemented by the class of the registered component, the supplied
priority
value will be ignored for that contract.
register
in interface Configurable<ResteasyProviderFactory>
register
in class ResteasyProviderFactory
component
- component instance to be configured in the scope of this
configurable context.priority
- the overriding priority for the registered component
and all the provider contracts the component implements.public void registerProvider(Class provider, boolean isBuiltin)
ResteasyProviderFactory
registerProvider
in class ResteasyProviderFactory
provider
- provider classisBuiltin
- built-inpublic Collection<String> getPropertyNames()
Configuration
collection
containing the
property names available within the context of the current configuration instance.
Use the Configuration.getProperty(java.lang.String)
method with a property name to get the value of
a property.
getPropertyNames
in interface Configuration
getPropertyNames
in class ResteasyProviderFactory
collection
of property names.Configuration.getProperty(java.lang.String)
public void addClientExceptionMapper(ClientExceptionMapper<?> provider, Class<?> providerClass)
addClientExceptionMapper
in class ResteasyProviderFactory
public void insertInterceptorPrecedenceAfter(String after, String newPrecedence)
insertInterceptorPrecedenceAfter
in class ResteasyProviderFactory
after
- put newPrecedence after thisnewPrecedence
- new precedencepublic ResteasyProviderFactory register(Object provider)
Configurable
feature
meta-provider) to be instantiated
and used in the scope of this configurable context.
Implementations SHOULD warn about and ignore registrations that do not
conform to the requirements of supported component types in the
given configurable context. Any subsequent registration attempts for a component
type, for which a class or instance-based registration already exists in the system
MUST be rejected by the API implementation and a warning SHOULD be raised to
inform the user about the rejected registration.
The registered component is registered as a contract provider of
all the recognized API or implementation-specific extension contracts including
meta-provider contracts, such as Feature
or DynamicFeature
.
As opposed to components registered via Configurable.register(Class)
method,
the lifecycle of providers registered using this instance-based register(...)
is not managed by the runtime. The same registered component instance is used during
the whole lifespan of the configurable context.
Fields and properties of all registered component instances are injected with their
declared dependencies (see Context
) by the runtime prior to use.
register
in interface Configurable<ResteasyProviderFactory>
register
in class ResteasyProviderFactory
provider
- component instance to be configured in the scope of this
configurable context.public <T> ConstructorInjector createConstructorInjector(Class<? extends T> clazz)
createConstructorInjector
in class ResteasyProviderFactory
public <T> T createProviderInstance(Class<? extends T> clazz)
ResteasyProviderFactory
createProviderInstance
in class ResteasyProviderFactory
T
- typeclazz
- classpublic boolean isRegistered(Class<?> componentClass)
Configuration
componentClass
class has been previously
registered in the runtime configuration context.
Method returns true
in case a component of the supplied componentClass
class
is already present among the previously registered component classes or instances
in the configuration context.
isRegistered
in interface Configuration
isRegistered
in class ResteasyProviderFactory
componentClass
- a component class to test for.true
if a component of a given class has been previously registered in this
configuration context, false
otherwise.Configuration.isEnabled(Class)
public void insertInterceptorPrecedenceBefore(String before, String newPrecedence)
insertInterceptorPrecedenceBefore
in class ResteasyProviderFactory
before
- put newPrecedence before thisnewPrecedence
- new precedencepublic <T> T createEndpoint(Application applicationConfig, Class<T> endpointType) throws IllegalArgumentException, UnsupportedOperationException
ResteasyProviderFactory
createEndpoint
in class ResteasyProviderFactory
T
- endpoint type.applicationConfig
- applicationendpointType
- endpoint typeIllegalArgumentException
- if applicationConfig is nullUnsupportedOperationException
- allways throw since this method is not supportedpublic Map<String,Object> getMutableProperties()
getMutableProperties
in class ResteasyProviderFactory
public Set<DynamicFeature> getServerDynamicFeatures()
getServerDynamicFeatures
in class ResteasyProviderFactory
public boolean isEnabled(Feature feature)
Configuration
feature
instance has been previously
enabled in the runtime configuration context.
Method returns true
only in case an instance equal to the feature
instance is already present among the features previously successfully enabled in
the configuration context.
isEnabled
in interface Configuration
isEnabled
in class ResteasyProviderFactory
feature
- a feature instance to test for.true
if the feature instance has been previously enabled in this
configuration context, false
otherwise.public Object getProperty(String name)
Configuration
getProperty
in interface Configuration
getProperty
in class ResteasyProviderFactory
name
- property name.null
if the property with such name is not configured.public WriterInterceptorRegistry getServerWriterInterceptorRegistry()
getServerWriterInterceptorRegistry
in class ResteasyProviderFactory
public ResteasyProviderFactory setProperties(Map<String,?> properties)
setProperties
in class ResteasyProviderFactory
public List<ClientErrorInterceptor> getClientErrorInterceptors()
ResteasyProviderFactory
ClientErrorInterceptor
instances.getClientErrorInterceptors
in class ResteasyProviderFactory
ClientErrorInterceptor
instancespublic void injectProperties(Class declaring, Object obj)
injectProperties
in class ResteasyProviderFactory
public UriBuilder createUriBuilder()
RuntimeDelegate
UriBuilder
.createUriBuilder
in class ResteasyProviderFactory
UriBuilder
instance.UriBuilder
public ResteasyProviderFactory register(Class<?> componentClass, Class<?>... contracts)
Configurable
feature
meta-provider) to be instantiated
and used in the scope of this configurable context.
This registration method provides the same functionality as Configurable.register(Class)
except the component class is only registered as a provider of the listed
extension provider or meta-provider contracts
.
All explicitly enumerated contract types must represent a class or an interface
implemented or extended by the registered component. Contracts that are not
assignable from
the registered component class
MUST be ignored and implementations SHOULD raise a warning to inform users about the
ignored contract(s).
register
in interface Configurable<ResteasyProviderFactory>
register
in class ResteasyProviderFactory
componentClass
- component class to be configured in the scope of this
configurable context.contracts
- the specific extension provider or meta-provider contracts
implemented by the component for which the component should
be registered.
Implementations MUST ignore attempts to register a component
class for an empty or null
collection of contracts via
this method and SHOULD raise a warning about such event.public <T> T injectedInstance(Class<? extends T> clazz)
ResteasyProviderFactory
injectedInstance
in class ResteasyProviderFactory
T
- typeclazz
- classpublic void appendInterceptorPrecedence(String precedence)
ResteasyProviderFactory
appendInterceptorPrecedence
in class ResteasyProviderFactory
precedence
- precedencepublic ResteasyProviderFactory getParent()
getParent
in class ResteasyProviderFactory
public RuntimeType getRuntimeType()
Configuration
getRuntimeType
in interface Configuration
getRuntimeType
in class ResteasyProviderFactory
public void injectProperties(Object obj)
injectProperties
in class ResteasyProviderFactory
public ResteasyProviderFactory property(String name, Object value)
Configurable
null
value into a property
effectively removes the property from the property bag.property
in interface Configurable<ResteasyProviderFactory>
property
in class ResteasyProviderFactory
name
- property name.value
- (new) property value. null
value removes the property
with the given name.public WriterInterceptorRegistry getClientWriterInterceptorRegistry()
getClientWriterInterceptorRegistry
in class ResteasyProviderFactory
public InjectorFactory getInjectorFactory()
getInjectorFactory
in class ResteasyProviderFactory
public Map<Class<?>,Integer> getContracts(Class<?> componentClass)
Configuration
Map
. Method does not return null
.getContracts
in interface Configuration
getContracts
in class ResteasyProviderFactory
public ParamConverter getParamConverter(Class clazz, Type genericType, Annotation[] annotations)
getParamConverter
in class ResteasyProviderFactory
public ClientResponseFilterRegistry getClientResponseFilters()
getClientResponseFilters
in class ResteasyProviderFactory
public ResteasyProviderFactory register(Object component, Class<?>... contracts)
Configurable
feature
meta-provider) to be instantiated
and used in the scope of this configurable context.
This registration method provides the same functionality as Configurable.register(Object)
except the component class is only registered as a provider of the listed
extension provider or meta-provider contracts
.
All explicitly enumerated contract types must represent a class or an interface
implemented or extended by the registered component. Contracts that are not
assignable from
the registered component class
MUST be ignored and implementations SHOULD raise a warning to inform users about the
ignored contract(s).
register
in interface Configurable<ResteasyProviderFactory>
register
in class ResteasyProviderFactory
component
- component instance to be configured in the scope of this
configurable context.contracts
- the specific extension provider or meta-provider contracts
implemented by the component for which the component should
be registered.
Implementations MUST ignore attempts to register a component
class for an empty or null
collection of contracts via
this method and SHOULD raise a warning about such event.public Set<Class<?>> getClasses()
Configuration
feature
) classes to be instantiated, injected and utilized in the scope
of the configurable instance.
For each component type, there can be only a single class-based or instance-based registration present in the configuration context at any given time.
getClasses
in interface Configuration
getClasses
in class ResteasyProviderFactory
null
.Configuration.getInstances()
public boolean isEnabled(Class<? extends Feature> featureClass)
Configuration
feature
instance of featureClass
class has been
previously enabled in the runtime configuration context.
Method returns true
in case any instance of the featureClass
class is
already present among the features previously successfully enabled in the configuration
context.
isEnabled
in interface Configuration
isEnabled
in class ResteasyProviderFactory
featureClass
- a feature class to test for.true
if a feature of a given class has been previously enabled in this
configuration context, false
otherwise.public void registerProvider(Class provider)
registerProvider
in class ResteasyProviderFactory
public void addHeaderDelegate(Class clazz, RuntimeDelegate.HeaderDelegate header)
addHeaderDelegate
in class ResteasyProviderFactory
public void registerProviderInstance(Object provider, Map<Class<?>,Integer> contracts, Integer defaultPriority, boolean builtIn)
registerProviderInstance
in class ResteasyProviderFactory
public void addStringParameterUnmarshaller(Class<? extends StringParameterUnmarshaller> provider)
addStringParameterUnmarshaller
in class ResteasyProviderFactory
public Set<Class<?>> getProviderClasses()
ResteasyProviderFactory
getProviderClasses
in class ResteasyProviderFactory
public String toString(Object object, Class clazz, Type genericType, Annotation[] annotations)
ResteasyProviderFactory
toString
in class ResteasyProviderFactory
object
- objectclazz
- classgenericType
- generic typeannotations
- array of annotationpublic ClientRequestFilterRegistry getClientRequestFilterRegistry()
getClientRequestFilterRegistry
in class ResteasyProviderFactory
@Deprecated public JaxrsInterceptorRegistry<ClientRequestFilter> getClientRequestFilters()
getClientRequestFilters
in class ResteasyProviderFactory
public Map<String,Object> getProperties()
Configuration
getProperties
in interface Configuration
getProperties
in class ResteasyProviderFactory
public String toHeaderString(Object object)
HeaderValueProcessor
toHeaderString
in interface HeaderValueProcessor
toHeaderString
in class ResteasyProviderFactory
object
- header objectpublic Link.Builder createLinkBuilder()
RuntimeDelegate
Link.Builder
.createLinkBuilder
in class ResteasyProviderFactory
Link.Builder
instance.Link.Builder
public Set<Object> getProviderInstances()
ResteasyProviderFactory
getProviderInstances
in class ResteasyProviderFactory
public Configuration getConfiguration()
Configurable
Configurable
instance will be reflected
in the returned Configuration
instance.
The returned Configuration
instance and the collection data it provides are not
thread-safe wrt. modification made using methods on the parent configurable object.
getConfiguration
in interface Configurable<ResteasyProviderFactory>
getConfiguration
in class ResteasyProviderFactory
public <T> MessageBodyWriter<T> getMessageBodyWriter(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType)
ResteasyProviderFactory
getMessageBodyWriter
in interface Providers
getMessageBodyWriter
in class ResteasyProviderFactory
T
- typetype
- the class of the 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 extends Throwable> ExceptionMapper<T> getExceptionMapper(Class<T> type)
Providers
type
.getExceptionMapper
in interface Providers
getExceptionMapper
in class ResteasyProviderFactory
T
- type of the exception handled by the exception mapping provider.type
- the class of exception.ExceptionMapper
for the supplied type or null
if none is found.public Map<Class<?>,ExceptionMapper> getExceptionMappers()
getExceptionMappers
in class ResteasyProviderFactory
public <T> AsyncResponseProvider<T> getAsyncResponseProvider(Class<T> type)
getAsyncResponseProvider
in class ResteasyProviderFactory
public Map<Class<?>,AsyncResponseProvider> getAsyncResponseProviders()
getAsyncResponseProviders
in class ResteasyProviderFactory
public <T> AsyncStreamProvider<T> getAsyncStreamProvider(Class<T> type)
getAsyncStreamProvider
in class ResteasyProviderFactory
public Map<Class<?>,AsyncStreamProvider> getAsyncStreamProviders()
getAsyncStreamProviders
in class ResteasyProviderFactory
public <T> RuntimeDelegate.HeaderDelegate<T> createHeaderDelegate(Class<T> tClass)
RuntimeDelegate
RuntimeDelegate.HeaderDelegate
for the supplied class. An
implementation is required to support the following values for type:
CacheControl
, Cookie
,
EntityTag
, Link
,
NewCookie
, MediaType
and java.util.Date
.createHeaderDelegate
in class ResteasyProviderFactory
T
- header type.tClass
- the class of the header.HeaderDelegate
for the supplied type.RuntimeDelegate.HeaderDelegate
public <T> MessageBodyWriter<T> getClientMessageBodyWriter(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType)
getClientMessageBodyWriter
in class ResteasyProviderFactory
public <T> MessageBodyReader<T> getClientMessageBodyReader(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType)
getClientMessageBodyReader
in class ResteasyProviderFactory
public <T> MessageBodyReader<T> getServerMessageBodyReader(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType)
getServerMessageBodyReader
in class ResteasyProviderFactory
public <T> MessageBodyWriter<T> getServerMessageBodyWriter(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType)
getServerMessageBodyWriter
in class ResteasyProviderFactory
Copyright © 2021 JBoss by Red Hat. All rights reserved.