|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.jersey.server.impl.application.WebApplicationContext
public final class WebApplicationContext
Field Summary | |
---|---|
static String |
HTTP_METHOD_MATCH_RESOURCE
|
Constructor Summary | |
---|---|
WebApplicationContext(WebApplicationImpl app,
ContainerRequest request,
ContainerResponse response)
|
Method Summary | |
---|---|
WebApplicationContext |
createMatchResourceContext(URI u)
|
URI |
getAbsolutePath()
Get the absolute path of the request. |
UriBuilder |
getAbsolutePathBuilder()
Get the absolute path of the request in the form of a UriBuilder. |
URI |
getBaseUri()
Get the base URI of the application. |
UriBuilder |
getBaseUriBuilder()
Get the base URI of the application in the form of a UriBuilder. |
ContainerRequest |
getContainerRequest()
Get the container request. |
ContainerResponse |
getContainerResponse()
Get the container response. |
Throwable |
getMappedThrowable()
Get the throwable that was mapped to a response. |
AbstractResourceMethod |
getMatchedMethod()
Get get matched resource method that was invoked. |
List<Object> |
getMatchedResources()
Get a read-only list of the currently matched resource class instances. |
List<MatchResult> |
getMatchedResults()
Get a read-only list of MatchResult for matched resources. |
List<UriTemplate> |
getMatchedTemplates()
Get a read-only list of UriTemplate for matched resources. |
List<String> |
getMatchedURIs()
Get a read-only list of URIs for matched resources. |
List<String> |
getMatchedURIs(boolean decode)
Get a read-only list of URIs for matched resources. |
MatchResult |
getMatchResult()
Get the match result |
String |
getPath()
Get the path of the current request relative to the base URI as a string. |
String |
getPath(boolean decode)
Get the path of the current request relative to the base URI as a string. |
MultivaluedMap<String,String> |
getPathParameters()
Get the values of any embedded URI template parameters. |
MultivaluedMap<String,String> |
getPathParameters(boolean decode)
Get the values of any embedded URI template parameters. |
List<PathSegment> |
getPathSegments()
Get the path of the current request relative to the base URI as a list of PathSegment . |
List<PathSegment> |
getPathSegments(boolean decode)
Get the path of the current request relative to the base URI as a list of PathSegment . |
List<PathSegment> |
getPathSegments(String name)
Get the path segments that contains a template variable. |
List<PathSegment> |
getPathSegments(String name,
boolean decode)
Get the path segments that contains a template variable. |
Map<String,Object> |
getProperties()
Get the mutable properties. |
MultivaluedMap<String,String> |
getQueryParameters()
Get the URI query parameters of the current request. |
MultivaluedMap<String,String> |
getQueryParameters(boolean decode)
Get the URI query parameters of the current request. |
HttpRequestContext |
getRequest()
Get the HTTP request information. |
URI |
getRequestUri()
Get the absolute request URI including any query parameters. |
UriBuilder |
getRequestUriBuilder()
Get the absolute request URI in the form of a UriBuilder. |
Object |
getResource(Class resourceClass)
Get the resource instance from a resource class. |
HttpResponseContext |
getResponse()
Get the HTTP response information. |
List<ContainerResponseFilter> |
getResponseFilters()
|
UriRules<UriRule> |
getRules(Class resourceClass)
Get the rules for a resource class. |
ExtendedUriInfo |
getUriInfo()
Get the extended URI information. |
boolean |
isTracingEnabled()
Check if tracing is enabled. |
void |
pushContainerResponseFilters(List<ContainerResponseFilter> filters)
Push a list of container response filters to apply after the container response has been produced. |
void |
pushMatch(UriTemplate template,
List<String> names)
Push a match. |
void |
pushMethod(AbstractResourceMethod arm)
Push the matching resource method. |
void |
pushResource(Object resource)
Push a matching resource. |
void |
pushRightHandPathLength(int rhpathlen)
Push the right hand path length to calculate the entry for the list of matching (ancestor) URI paths. |
void |
setContainerRequest(ContainerRequest request)
Set the container request. |
void |
setContainerResponse(ContainerResponse response)
Set the container response. |
void |
setMatchResult(MatchResult matchResult)
Set the match result |
void |
trace(String message)
Add a trace message. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String HTTP_METHOD_MATCH_RESOURCE
Constructor Detail |
---|
public WebApplicationContext(WebApplicationImpl app, ContainerRequest request, ContainerResponse response)
Method Detail |
---|
public WebApplicationContext createMatchResourceContext(URI u)
public List<ContainerResponseFilter> getResponseFilters()
public HttpRequestContext getRequest()
HttpContext
getRequest
in interface HttpContext
public HttpResponseContext getResponse()
HttpContext
getResponse
in interface HttpContext
public ExtendedUriInfo getUriInfo()
HttpContext
getUriInfo
in interface HttpContext
public Map<String,Object> getProperties()
HttpContext
Care should be taken not to clear the properties or remove properties that are unknown otherwise unspecified behaviour may result.
getProperties
in interface HttpContext
public boolean isTracingEnabled()
Traceable
isTracingEnabled
in interface Traceable
public void trace(String message)
Traceable
A trace message will be added if Traceable.isTracingEnabled()
returns
true and tracing contraints are satisfied.
trace
in interface Traceable
message
- the trace message to add.public MatchResult getMatchResult()
UriMatchResultContext
getMatchResult
in interface UriMatchResultContext
public void setMatchResult(MatchResult matchResult)
UriMatchResultContext
setMatchResult
in interface UriMatchResultContext
matchResult
- the match result.public ContainerRequest getContainerRequest()
UriRuleContext
getContainerRequest
in interface UriRuleContext
public void setContainerRequest(ContainerRequest request)
UriRuleContext
setContainerRequest
in interface UriRuleContext
request
- the container request.public ContainerResponse getContainerResponse()
UriRuleContext
getContainerResponse
in interface UriRuleContext
public void setContainerResponse(ContainerResponse response)
UriRuleContext
setContainerResponse
in interface UriRuleContext
response
- the container response.public void pushContainerResponseFilters(List<ContainerResponseFilter> filters)
UriRuleContext
The list of response filters is processed in reverse order of last to first.
pushContainerResponseFilters
in interface UriRuleContext
filters
- the list container response filterspublic Object getResource(Class resourceClass)
UriRuleContext
getResource
in interface UriRuleContext
resourceClass
- the resource class
public UriRules<UriRule> getRules(Class resourceClass)
UriRuleContext
getRules
in interface UriRuleContext
resourceClass
- the resource class that has rules
public void pushMatch(UriTemplate template, List<String> names)
UriRuleContext
pushMatch
in interface UriRuleContext
template
- the matching URI template.names
- the parameter names associated with the capturing group
values.public void pushResource(Object resource)
UriRuleContext
pushResource
in interface UriRuleContext
resource
- the matching resourcepublic void pushMethod(AbstractResourceMethod arm)
UriRuleContext
pushMethod
in interface UriRuleContext
arm
- the matching resource method.public void pushRightHandPathLength(int rhpathlen)
UriRuleContext
pushRightHandPathLength
in interface UriRuleContext
rhpathlen
- the right hand lengthpublic URI getBaseUri()
UriInfo
getBaseUri
in interface UriInfo
public UriBuilder getBaseUriBuilder()
UriInfo
getBaseUriBuilder
in interface UriInfo
public URI getAbsolutePath()
UriInfo
uriInfo.getBase().resolve(uriInfo.getPath()).
getAbsolutePath
in interface UriInfo
public UriBuilder getAbsolutePathBuilder()
UriInfo
getAbsolutePathBuilder
in interface UriInfo
public URI getRequestUri()
UriInfo
getRequestUri
in interface UriInfo
public UriBuilder getRequestUriBuilder()
UriInfo
getRequestUriBuilder
in interface UriInfo
public String getPath()
UriInfo
getPath(true)
.
getPath
in interface UriInfo
public String getPath(boolean decode)
UriInfo
getPath
in interface UriInfo
decode
- controls whether sequences of escaped octets are decoded
(true) or not (false).
public List<PathSegment> getPathSegments()
UriInfo
PathSegment
. This method is useful when the
path needs to be parsed, particularly when matrix parameters may be
present in the path. All sequences of escaped octets in path segments
and matrix parameter values are decoded,
equivalent to getPathSegments(true)
.
getPathSegments
in interface UriInfo
PathSegment
. The matrix parameter
map of each path segment is also unmodifiable.PathSegment
,
Matrix URIspublic List<PathSegment> getPathSegments(boolean decode)
UriInfo
PathSegment
. This method is useful when the
path needs to be parsed, particularly when matrix parameters may be
present in the path.
getPathSegments
in interface UriInfo
decode
- controls whether sequences of escaped octets in path segments
and matrix parameter values are decoded (true) or not (false).
PathSegment
. The matrix parameter
map of each path segment is also unmodifiable.PathSegment
,
Matrix URIspublic MultivaluedMap<String,String> getQueryParameters()
UriInfo
getQueryParameters(true)
.
getQueryParameters
in interface UriInfo
public MultivaluedMap<String,String> getQueryParameters(boolean decode)
UriInfo
getQueryParameters
in interface UriInfo
decode
- controls whether sequences of escaped octets in parameter
values are decoded (true) or not (false).
public MultivaluedMap<String,String> getPathParameters()
UriInfo
getPathParameters(true)
.
getPathParameters
in interface UriInfo
Path
,
PathParam
public MultivaluedMap<String,String> getPathParameters(boolean decode)
UriInfo
getPathParameters
in interface UriInfo
decode
- controls whether sequences of escaped octets are decoded
(true) or not (false).
Path
,
PathParam
public List<String> getMatchedURIs()
UriInfo
getMatchedURIs(true)
.
Entries do not include query parameters but do include matrix parameters
if present in the request URI. Entries are ordered in reverse request
URI matching order, with the current resource URI first. E.g. given the
following resource classes:
@Path("foo") public class FooResource { @GET public String getFoo() {...} @Path("bar") public BarResource getBarResource() {...} } public class BarResource { @GET public String getBar() {...} }
The values returned by this method based on request uri and where the method is called from are:
Request | Called from | Value(s) |
---|---|---|
GET /foo | FooResource.getFoo | foo |
GET /foo/bar | FooResource.getBarResource | foo/bar, foo |
GET /foo/bar | BarResource.getBar | foo/bar, foo |
getMatchedURIs
in interface UriInfo
public List<String> getMatchedURIs(boolean decode)
UriInfo
UriInfo.getMatchedURIs()
for an
example.
getMatchedURIs
in interface UriInfo
decode
- controls whether sequences of escaped octets are decoded
(true) or not (false).
public List<Object> getMatchedResources()
UriInfo
@Path("foo") public class FooResource { @GET public String getFoo() {...} @Path("bar") public BarResource getBarResource() {...} } public class BarResource { @GET public String getBar() {...} }
The values returned by this method based on request uri and where the method is called from are:
Request | Called from | Value(s) |
---|---|---|
GET /foo | FooResource.getFoo | FooResource |
GET /foo/bar | FooResource.getBarResource | FooResource |
GET /foo/bar | BarResource.getBar | BarResource, FooResource |
getMatchedResources
in interface UriInfo
public AbstractResourceMethod getMatchedMethod()
ExtendedUriInfo
getMatchedMethod
in interface ExtendedUriInfo
public Throwable getMappedThrowable()
ExtendedUriInfo
A response filter or a message body writer may utilize this method to determine if a resource method was invoked but did not return a response because an exception was thrown from the resource method, or the resource method returned but a response filter threw an exception.
getMappedThrowable
in interface ExtendedUriInfo
ContainerResponse.getMappedThrowable()
public List<MatchResult> getMatchedResults()
ExtendedUriInfo
MatchResult
for matched resources.
Entries are ordered in reverse request URI matching order, with the
root resource match result last.
getMatchedResults
in interface ExtendedUriInfo
public List<UriTemplate> getMatchedTemplates()
ExtendedUriInfo
UriTemplate
for matched resources.
Each entry is a URI template that is the value of the
Path
that is a partial path that matched a resource
class, a sub-resource method or a sub-resource locator.
Entries are ordered in reverse request URI matching order, with the
root resource URI template last.
getMatchedTemplates
in interface ExtendedUriInfo
public List<PathSegment> getPathSegments(String name)
ExtendedUriInfo
getPathSegments(true)
.
getPathSegments
in interface ExtendedUriInfo
name
- the template variable name
public List<PathSegment> getPathSegments(String name, boolean decode)
ExtendedUriInfo
getPathSegments
in interface ExtendedUriInfo
name
- the template variable namedecode
- controls whether sequences of escaped octets are decoded
(true) or not (false).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |