javax.ws.rs.container
Interface DynamicBinder<T>

Type Parameters:
T - Filter or interceptor type provided by the dynamic binder.

public interface DynamicBinder<T>

A dynamic (post-matching) filter or interceptor binding provider. Dynamic binding provider is used by JAX-RS runtime to provide a the filter or interceptor that shall be applied to a particular resource class and method and overrides any annotation-based binding definitions defined on the returned resource filter or interceptor instance.

Providers implementing this interface MUST be annotated with @Provider annotation to be discovered by JAX-RS runtime. This type of providers is supported only as part of the Server API.

Since:
2.0
Author:
Santiago Pericas-Geertsen, Bill Burke, Marek Potociar
See Also:
NameBinding

Method Summary
 T getBoundProvider(ResourceInfo resourceInfo)
          Get the filter or interceptor instance or class that should be bound to the particular resource method.
 

Method Detail

getBoundProvider

T getBoundProvider(ResourceInfo resourceInfo)
Get the filter or interceptor instance or class that should be bound to the particular resource method. May return null.

The returned provider instance or class is expected to be implementing one or more of the following interfaces:

A provider instance or class that does not implement any of the interfaces above is ignored and a warning message is logged.

If the returned object is a Class<P>, JAX-RS runtime will resolve the class to an instance of type P by first looking at the already registered provider instances. If there is already a provider instance of the class registered, the JAX-RS runtime will use it, otherwise a new provider instance of the class will be instantiated, injected and registered by the JAX-RS runtime.

In case the resolving the returned provider class to an instance fails for any reason, the dynamically bound provider class is ignored and a warning message is logged.

The method is called during a (sub)resource method discovery phase (typically once per each discovered (sub)resource method) to return a filter instance that should be bound to a particular (sub)resource method identified by the supplied resource information.

Parameters:
resourceInfo - resource class and method information.
Returns:
a filter or interceptor instance that should be dynamically bound to the (sub)resource method or null otherwise.


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