|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ResourceContext
The resource context provides access to instances of resource classes.
This interface can be injected using the Context annotation.
The resource context can be utilized when instances of managed resource classes are to be returned by sub-resource locator methods. Such instances will be injected and managed within the declared scope just like instances of root resource classes.
The resource context can also be utilized when matching of URIs is
required, for example when validating a URI sent in a request entity.
Users should be aware that application functionality may be affected as the
matching process will result in the construction or sharing of previously
constructed resource classes that are in scope of the HTTP request, and the
invocation of any matching sub-resource locator methods. However, no
resource or sub-resource methods will be
invoked.
| Method Summary | ||
|---|---|---|
|
getResource(java.lang.Class<T> resourceClass)
Get a resolved instance of a resource class. |
|
java.lang.Object |
matchResource(java.net.URI uri)
Match a URI to a resource instance. |
|
|
matchResource(java.net.URI uri,
java.lang.Class<T> type)
Match a URI to a resource instance of a particular Java type. |
|
UriInfo |
matchUriInfo(java.net.URI uri)
Match a URI to a URI information. |
|
| Method Detail |
|---|
UriInfo matchUriInfo(java.net.URI uri)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException
URI information.
If the URI is relative then the base URI of the application will be used to resolve the relative URI to an absolute URI. If the URI is absolute then it must match the base URI of the application, otherwise an IllegalArgumentException is thrown.
uri - the URI to be matched. Must not be null.
null if the URI cannot be matched.
java.lang.NullPointerException - if the uri parameter is null.
java.lang.IllegalArgumentException - if the uri parameter represents an absolute
URI that does not match the base URI of the application.
java.lang.Object matchResource(java.net.URI uri)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException
If the URI is relative then the base URI of the application will be used to resolve the relative URI to an absolute URI. If the URI is absolute then it must match the base URI of the application, otherwise an IllegalArgumentException is thrown.
uri - the URI to be matched. Must not be null.
null if the URI cannot be matched.
java.lang.NullPointerException - if the uri parameter is null.
java.lang.IllegalArgumentException - if the uri parameter represents an absolute
URI that does not match the base URI of the application.
<T> T matchResource(java.net.URI uri,
java.lang.Class<T> type)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.ClassCastException
If the URI is relative then the base URI of the application will be used to resolve the relative URI to an absolute URI. If the URI is absolute then it must match the base URI of the application, otherwise an IllegalArgumentException is thrown.
T - the type of the resource class.uri - the URI to be matched. Must not be null.type - the resource class.
null if the URI cannot be matched.
java.lang.NullPointerException - if the uri parameter is null.
java.lang.IllegalArgumentException - if the uri parameter represents an absolute
URI that does not match the base URI of the application.
java.lang.ClassCastException - if the resource instance cannot be cast to
type.<T> T getResource(java.lang.Class<T> resourceClass)
The resolved resource instance is properly initialized in the context of the current request processing scope. The scope of the resolved resource instance depends on the managing container. For resources managed by JAX-RS container the default scope is per-request.
T - the type of the resource class.resourceClass - the resource class.
null.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||