|
||||||||||
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 be utilized when matching of URIs are required, for example when validating URIs sent in a request entity. Note 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 matching sub-resource locator methods. No resource methods wll be invoked.
Method Summary | ||
---|---|---|
|
getResource(java.lang.Class<T> c)
Provides an instance of the given resource class. |
|
java.lang.Object |
matchResource(java.net.URI u)
Match a URI to a resource instance. |
|
|
matchResource(java.net.URI u,
java.lang.Class<T> c)
Match a URI to a resource instance. |
|
ExtendedUriInfo |
matchUriInfo(java.net.URI u)
Match a URI to URI information. |
Method Detail |
---|
ExtendedUriInfo matchUriInfo(java.net.URI u) throws ContainerException
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 be relative to the base URI of the application.
u
- the URI.
ContainerException
- if there is an error when matching.java.lang.Object matchResource(java.net.URI u) throws ContainerException
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 be relative to the base URI of the application.
u
- the URI.
ContainerException
- if there is an error when matching.<T> T matchResource(java.net.URI u, java.lang.Class<T> c) throws ContainerException, 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 be relative to the base URI of the application.
T
- the type of the resource.u
- the URI.c
- the resource class.
ContainerException
- if there is an error when matching.
java.lang.ClassCastException
- if the resource instance cannot be cast to
c
.<T> T getResource(java.lang.Class<T> c) throws ContainerException
T
- the type of the resource classc
- the resource class
ContainerException
- if the resource
class cannot be found.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |