public class AdaptingContainerRequest extends ContainerRequest
ContainerRequest
.Modifier and Type | Field and Description |
---|---|
protected ContainerRequest |
acr
The adapted container request.
|
VARY_HEADER
ACCEPT, ACCEPT_CHARSET, ACCEPT_ENCODING, ACCEPT_LANGUAGE, AUTHORIZATION, CACHE_CONTROL, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_TYPE, COOKIE, DATE, ETAG, EXPIRES, HOST, IF_MATCH, IF_MODIFIED_SINCE, IF_NONE_MATCH, IF_UNMODIFIED_SINCE, LAST_MODIFIED, LOCATION, SET_COOKIE, USER_AGENT, VARY, WWW_AUTHENTICATE
Modifier | Constructor and Description |
---|---|
protected |
AdaptingContainerRequest(ContainerRequest acr)
Create the adapting container request.
|
Modifier and Type | Method and Description |
---|---|
javax.ws.rs.core.Response.ResponseBuilder |
evaluatePreconditions() |
javax.ws.rs.core.Response.ResponseBuilder |
evaluatePreconditions(Date lastModified) |
javax.ws.rs.core.Response.ResponseBuilder |
evaluatePreconditions(Date lastModified,
javax.ws.rs.core.EntityTag eTag) |
javax.ws.rs.core.Response.ResponseBuilder |
evaluatePreconditions(javax.ws.rs.core.EntityTag eTag) |
URI |
getAbsolutePath()
Get the absolute path of the request.
|
javax.ws.rs.core.UriBuilder |
getAbsolutePathBuilder()
Get the absolute path of the request in the form of a UriBuilder.
|
List<Locale> |
getAcceptableLanguages() |
javax.ws.rs.core.MediaType |
getAcceptableMediaType(List<javax.ws.rs.core.MediaType> mediaTypes)
Select the first media type, from a list of media types, that is most
acceptable according to the requested acceptable media types.
|
List<javax.ws.rs.core.MediaType> |
getAcceptableMediaTypes() |
List<javax.ws.rs.core.MediaType> |
getAcceptableMediaTypes(List<QualitySourceMediaType> priorityMediaTypes)
Get a list of media types that are acceptable for the response.
|
String |
getAuthenticationScheme() |
URI |
getBaseUri()
Get the base URI of the application.
|
javax.ws.rs.core.UriBuilder |
getBaseUriBuilder()
Get the base URI of the application in the form of a UriBuilder.
|
javax.ws.rs.core.MultivaluedMap<String,String> |
getCookieNameValueMap()
Get the cookie name value map.
|
Map<String,javax.ws.rs.core.Cookie> |
getCookies() |
<T> T |
getEntity(Class<T> type)
Get the request entity, returns null if the request does not
contain an entity body.
|
<T> T |
getEntity(Class<T> type,
Type genericType,
Annotation[] as)
Get the request entity, returns null if the request does not
contain an entity body.
|
InputStream |
getEntityInputStream()
Get the input stream of the entity.
|
Form |
getFormParameters()
Get the form parameters of the request entity.
|
String |
getHeaderValue(String name)
Get a HTTP header value.
|
Locale |
getLanguage() |
javax.ws.rs.core.MediaType |
getMediaType() |
MessageBodyWorkers |
getMessageBodyWorkers()
Get the message body workers.
|
String |
getMethod() |
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.
|
List<javax.ws.rs.core.PathSegment> |
getPathSegments()
Get the path of the current request relative to the base URI as a
list of
PathSegment . |
List<javax.ws.rs.core.PathSegment> |
getPathSegments(boolean decode)
Get the path of the current request relative to the base URI as a
list of
PathSegment . |
Map<String,Object> |
getProperties()
Get the mutable properties.
|
javax.ws.rs.core.MultivaluedMap<String,String> |
getQueryParameters()
Get the URI query parameters of the current request.
|
javax.ws.rs.core.MultivaluedMap<String,String> |
getQueryParameters(boolean decode)
Get the URI query parameters of the current request.
|
List<String> |
getRequestHeader(String name) |
javax.ws.rs.core.MultivaluedMap<String,String> |
getRequestHeaders() |
URI |
getRequestUri()
Get the absolute request URI.
|
javax.ws.rs.core.UriBuilder |
getRequestUriBuilder()
Get the absolute request URI in the form of a UriBuilder.
|
javax.ws.rs.core.SecurityContext |
getSecurityContext()
Get the security context.
|
Principal |
getUserPrincipal() |
boolean |
isSecure() |
boolean |
isTracingEnabled()
Check if tracing is enabled.
|
boolean |
isUserInRole(String role) |
javax.ws.rs.core.Variant |
selectVariant(List<javax.ws.rs.core.Variant> variants) |
void |
setEntityInputStream(InputStream entity)
Set the input stream of the entity.
|
void |
setHeaders(InBoundHeaders headers)
Set the request headers.
|
void |
setMethod(String method)
Set the HTTP method.
|
void |
setSecurityContext(javax.ws.rs.core.SecurityContext securityContext)
Set the security context.
|
void |
setUris(URI baseUri,
URI requestUri)
Set the base and request URI.
|
void |
trace(String message)
Add a trace message.
|
setEntity
protected final ContainerRequest acr
protected AdaptingContainerRequest(ContainerRequest acr)
acr
- the container request to adapt.public Map<String,Object> getProperties()
ContainerRequest
getProperties
in class ContainerRequest
public void setMethod(String method)
ContainerRequest
setMethod
in class ContainerRequest
method
- the method.public void setUris(URI baseUri, URI requestUri)
ContainerRequest
setUris
in class ContainerRequest
baseUri
- the base URI.requestUri
- the (complete) request URI.public InputStream getEntityInputStream()
ContainerRequest
getEntityInputStream
in class ContainerRequest
public void setEntityInputStream(InputStream entity)
ContainerRequest
setEntityInputStream
in class ContainerRequest
entity
- the input stream of the entity.public void setHeaders(InBoundHeaders headers)
ContainerRequest
setHeaders
in class ContainerRequest
headers
- the request headers.public void setSecurityContext(javax.ws.rs.core.SecurityContext securityContext)
ContainerRequest
setSecurityContext
in class ContainerRequest
securityContext
- the security context.public javax.ws.rs.core.SecurityContext getSecurityContext()
ContainerRequest
getSecurityContext
in class ContainerRequest
public MessageBodyWorkers getMessageBodyWorkers()
ContainerRequest
getMessageBodyWorkers
in class ContainerRequest
public boolean isTracingEnabled()
Traceable
isTracingEnabled
in interface Traceable
isTracingEnabled
in class ContainerRequest
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
trace
in class ContainerRequest
message
- the trace message to add.public URI getBaseUri()
HttpRequestContext
getBaseUri
in interface HttpRequestContext
getBaseUri
in class ContainerRequest
public javax.ws.rs.core.UriBuilder getBaseUriBuilder()
HttpRequestContext
getBaseUriBuilder
in interface HttpRequestContext
getBaseUriBuilder
in class ContainerRequest
public URI getRequestUri()
HttpRequestContext
getRequestUri
in interface HttpRequestContext
getRequestUri
in class ContainerRequest
public javax.ws.rs.core.UriBuilder getRequestUriBuilder()
HttpRequestContext
getRequestUriBuilder
in interface HttpRequestContext
getRequestUriBuilder
in class ContainerRequest
public URI getAbsolutePath()
HttpRequestContext
uriInfo.getBase().resolve(uriInfo.getPath()).
getAbsolutePath
in interface HttpRequestContext
getAbsolutePath
in class ContainerRequest
public javax.ws.rs.core.UriBuilder getAbsolutePathBuilder()
HttpRequestContext
getAbsolutePathBuilder
in interface HttpRequestContext
getAbsolutePathBuilder
in class ContainerRequest
public String getPath()
HttpRequestContext
getPath(true)
.getPath
in interface HttpRequestContext
getPath
in class ContainerRequest
public String getPath(boolean decode)
HttpRequestContext
getPath
in interface HttpRequestContext
getPath
in class ContainerRequest
decode
- controls whether sequences of escaped octets are decoded
(true) or not (false).public List<javax.ws.rs.core.PathSegment> getPathSegments()
HttpRequestContext
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 names and values are decoded,
equivalent to getPathSegments(true)
.getPathSegments
in interface HttpRequestContext
getPathSegments
in class ContainerRequest
PathSegment
. The matrix parameter
map of each path segment is also unmodifiable.PathSegment
,
Matrix URIspublic List<javax.ws.rs.core.PathSegment> getPathSegments(boolean decode)
HttpRequestContext
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 HttpRequestContext
getPathSegments
in class ContainerRequest
decode
- controls whether sequences of escaped octets in path segments
and matrix parameter names and values are decoded (true) or not (false).PathSegment
. The matrix parameter
map of each path segment is also unmodifiable.PathSegment
,
Matrix URIspublic javax.ws.rs.core.MultivaluedMap<String,String> getQueryParameters()
HttpRequestContext
getQueryParameters(true)
.getQueryParameters
in interface HttpRequestContext
getQueryParameters
in class ContainerRequest
public javax.ws.rs.core.MultivaluedMap<String,String> getQueryParameters(boolean decode)
HttpRequestContext
getQueryParameters
in interface HttpRequestContext
getQueryParameters
in class ContainerRequest
decode
- controls whether sequences of escaped octets in parameter
names and values are decoded (true) or not (false).public String getHeaderValue(String name)
HttpRequestContext
getHeaderValue
in interface HttpRequestContext
getHeaderValue
in class ContainerRequest
name
- the HTTP headerpublic javax.ws.rs.core.MediaType getAcceptableMediaType(List<javax.ws.rs.core.MediaType> mediaTypes)
HttpRequestContext
getAcceptableMediaType
in interface HttpRequestContext
getAcceptableMediaType
in class ContainerRequest
mediaTypes
- the list of media typespublic List<javax.ws.rs.core.MediaType> getAcceptableMediaTypes(List<QualitySourceMediaType> priorityMediaTypes)
HttpRequestContext
getAcceptableMediaTypes
in interface HttpRequestContext
getAcceptableMediaTypes
in class ContainerRequest
priorityMediaTypes
- the list of media types that take priority,
ordered according to the quality source parameter, "qs" as the
primary key.public javax.ws.rs.core.MultivaluedMap<String,String> getCookieNameValueMap()
HttpRequestContext
getCookieNameValueMap
in interface HttpRequestContext
getCookieNameValueMap
in class ContainerRequest
public <T> T getEntity(Class<T> type) throws javax.ws.rs.WebApplicationException
HttpRequestContext
getEntity
in interface HttpRequestContext
getEntity
in class ContainerRequest
type
- the type of entityjavax.ws.rs.WebApplicationException
- if the content of the request
cannot be mapped to an entity of the requested typepublic <T> T getEntity(Class<T> type, Type genericType, Annotation[] as) throws javax.ws.rs.WebApplicationException
HttpRequestContext
getEntity
in interface HttpRequestContext
getEntity
in class ContainerRequest
type
- the type of entitygenericType
- type the generic type of entity, it is the responsibility
of the callee to ensure that the type and generic type are
consistent otherwise the behaviour of this method is undefined.as
- the annotations associated with the typejavax.ws.rs.WebApplicationException
- if the content of the request
cannot be mapped to an entity of the requested typepublic Form getFormParameters()
HttpRequestContext
This method will ensure that the request entity is buffered such that it may be consumed by the application.
getFormParameters
in interface HttpRequestContext
getFormParameters
in class ContainerRequest
public List<String> getRequestHeader(String name)
getRequestHeader
in interface javax.ws.rs.core.HttpHeaders
getRequestHeader
in class ContainerRequest
public javax.ws.rs.core.MultivaluedMap<String,String> getRequestHeaders()
getRequestHeaders
in interface javax.ws.rs.core.HttpHeaders
getRequestHeaders
in class ContainerRequest
public List<javax.ws.rs.core.MediaType> getAcceptableMediaTypes()
getAcceptableMediaTypes
in interface javax.ws.rs.core.HttpHeaders
getAcceptableMediaTypes
in class ContainerRequest
public List<Locale> getAcceptableLanguages()
getAcceptableLanguages
in interface javax.ws.rs.core.HttpHeaders
getAcceptableLanguages
in class ContainerRequest
public javax.ws.rs.core.MediaType getMediaType()
getMediaType
in interface javax.ws.rs.core.HttpHeaders
getMediaType
in class ContainerRequest
public Locale getLanguage()
getLanguage
in interface javax.ws.rs.core.HttpHeaders
getLanguage
in class ContainerRequest
public Map<String,javax.ws.rs.core.Cookie> getCookies()
getCookies
in interface javax.ws.rs.core.HttpHeaders
getCookies
in class ContainerRequest
public String getMethod()
getMethod
in interface javax.ws.rs.core.Request
getMethod
in class ContainerRequest
public javax.ws.rs.core.Variant selectVariant(List<javax.ws.rs.core.Variant> variants) throws IllegalArgumentException
selectVariant
in interface javax.ws.rs.core.Request
selectVariant
in class ContainerRequest
IllegalArgumentException
public javax.ws.rs.core.Response.ResponseBuilder evaluatePreconditions(javax.ws.rs.core.EntityTag eTag)
evaluatePreconditions
in interface javax.ws.rs.core.Request
evaluatePreconditions
in class ContainerRequest
public javax.ws.rs.core.Response.ResponseBuilder evaluatePreconditions(Date lastModified)
evaluatePreconditions
in interface javax.ws.rs.core.Request
evaluatePreconditions
in class ContainerRequest
public javax.ws.rs.core.Response.ResponseBuilder evaluatePreconditions(Date lastModified, javax.ws.rs.core.EntityTag eTag)
evaluatePreconditions
in interface javax.ws.rs.core.Request
evaluatePreconditions
in class ContainerRequest
public javax.ws.rs.core.Response.ResponseBuilder evaluatePreconditions()
evaluatePreconditions
in interface javax.ws.rs.core.Request
evaluatePreconditions
in class ContainerRequest
public Principal getUserPrincipal()
getUserPrincipal
in interface javax.ws.rs.core.SecurityContext
getUserPrincipal
in class ContainerRequest
public boolean isUserInRole(String role)
isUserInRole
in interface javax.ws.rs.core.SecurityContext
isUserInRole
in class ContainerRequest
public boolean isSecure()
isSecure
in interface javax.ws.rs.core.SecurityContext
isSecure
in class ContainerRequest
public String getAuthenticationScheme()
getAuthenticationScheme
in interface javax.ws.rs.core.SecurityContext
getAuthenticationScheme
in class ContainerRequest
Copyright © 2013 Oracle Corporation. All rights reserved.