public class ContainerRequest extends InboundMessageContext implements ContainerRequestContext, Request, HttpHeaders
ApplicationHandler for each incoming client request.ACCEPT, ACCEPT_CHARSET, ACCEPT_ENCODING, ACCEPT_LANGUAGE, ALLOW, 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, LINK, LOCATION, RETRY_AFTER, SET_COOKIE, USER_AGENT, VARY, WWW_AUTHENTICATE| Constructor and Description |
|---|
ContainerRequest(URI baseUri,
URI requestUri,
String httpMethod,
SecurityContext securityContext,
PropertiesDelegate propertiesDelegate)
Create new Jersey container request context.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abortWith(Response response) |
Response.ResponseBuilder |
evaluatePreconditions() |
Response.ResponseBuilder |
evaluatePreconditions(Date lastModified) |
Response.ResponseBuilder |
evaluatePreconditions(Date lastModified,
EntityTag eTag) |
Response.ResponseBuilder |
evaluatePreconditions(EntityTag eTag) |
Response |
getAbortResponse()
Get the request filter chain aborting response if set, or
null otherwise. |
List<Locale> |
getAcceptableLanguages() |
List<MediaType> |
getAcceptableMediaTypes() |
URI |
getBaseUri()
Get base request URI.
|
Map<String,Cookie> |
getCookies() |
String |
getMethod() |
String |
getPath(boolean decode)
Get the path of the current request relative to the application root (base)
URI as a string.
|
PropertiesDelegate |
getPropertiesDelegate()
Get the underlying properties delegate.
|
Object |
getProperty(String name) |
Collection<String> |
getPropertyNames() |
Request |
getRequest() |
List<String> |
getRequestHeader(String name)
Get the values of a HTTP request header.
|
MultivaluedMap<String,String> |
getRequestHeaders()
Get the values of HTTP request headers.
|
RequestScopedInitializer |
getRequestScopedInitializer()
Get a custom container extensions initializer for the current request.
|
URI |
getRequestUri()
Get request URI.
|
ContainerResponseWriter |
getResponseWriter()
Get the container response writer for the current request.
|
SecurityContext |
getSecurityContext() |
UriInfo |
getUriInfo() |
String |
getVaryValue()
Get the value of HTTP Vary response header to be set in the response,
or
null if no value is to be set. |
<T> T |
readEntity(Class<T> rawType)
Read entity from a context entity input stream.
|
<T> T |
readEntity(Class<T> rawType,
Annotation[] annotations)
Read entity from a context entity input stream.
|
<T> T |
readEntity(Class<T> rawType,
Type type)
Read entity from a context entity input stream.
|
<T> T |
readEntity(Class<T> rawType,
Type type,
Annotation[] annotations)
Read entity from a context entity input stream.
|
void |
removeProperty(String name) |
Variant |
selectVariant(List<Variant> variants) |
void |
setMethod(String method) |
void |
setMethodWithoutException(String method)
Like
setMethod(String) but does not throw IllegalStateException if the method is invoked in other than
pre-matching phase. |
void |
setProperty(String name,
Object object) |
void |
setRequestScopedInitializer(RequestScopedInitializer requestScopedInitializer)
Set a custom container extensions initializer for the current request.
|
void |
setRequestUri(URI requestUri) |
void |
setRequestUri(URI baseUri,
URI requestUri) |
void |
setSecurityContext(SecurityContext context) |
void |
setUriInfo(UriInfo uriInfo)
Set the request scoped
UriInfo instance. |
void |
setWriter(ContainerResponseWriter responseWriter)
Set the container response writer for the current request.
|
bufferEntity, close, getAllowedMethods, getDate, getEntityStream, getEntityTag, getHeaders, getHeaderString, getIfMatch, getIfNoneMatch, getLanguage, getLastModified, getLength, getLink, getLinkBuilder, getLinks, getLocation, getMediaType, getQualifiedAcceptableLanguages, getQualifiedAcceptableMediaTypes, getQualifiedAcceptCharset, getQualifiedAcceptEncoding, getRequestCookies, getResponseCookies, getWorkers, hasEntity, hasLink, header, headers, headers, headers, headers, readEntity, readEntity, readEntity, readEntity, remove, setEntityStream, setWorkersclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDate, getEntityStream, getHeaders, getHeaderString, getLanguage, getLength, getMediaType, hasEntity, setEntityStreamgetDate, getHeaderString, getLanguage, getLength, getMediaTypepublic ContainerRequest(URI baseUri, URI requestUri, String httpMethod, SecurityContext securityContext, PropertiesDelegate propertiesDelegate)
baseUri - base application URI.requestUri - request URI.httpMethod - request HTTP method name.securityContext - security context of the current request. Must not be null.
The SecurityContext.getUserPrincipal() must return
null if the current request has not been authenticated
by the container.propertiesDelegate - custom properties delegate
to be used by the context.public RequestScopedInitializer getRequestScopedInitializer()
null if not
available.public void setRequestScopedInitializer(RequestScopedInitializer requestScopedInitializer)
requestScopedInitializer - custom container extensions initializer.public ContainerResponseWriter getResponseWriter()
public void setWriter(ContainerResponseWriter responseWriter)
responseWriter - container response writer. Must not be null.public <T> T readEntity(Class<T> rawType)
T - entity Java object type.rawType - raw Java entity type.public <T> T readEntity(Class<T> rawType, Annotation[] annotations)
T - entity Java object type.rawType - raw Java entity type.annotations - entity annotations.public <T> T readEntity(Class<T> rawType, Type type)
T - entity Java object type.rawType - raw Java entity type.type - generic Java entity type.public <T> T readEntity(Class<T> rawType, Type type, Annotation[] annotations)
T - entity Java object type.rawType - raw Java entity type.type - generic Java entity type.annotations - entity annotations.public Object getProperty(String name)
getProperty in interface ContainerRequestContextpublic Collection<String> getPropertyNames()
getPropertyNames in interface ContainerRequestContextpublic void setProperty(String name, Object object)
setProperty in interface ContainerRequestContextpublic void removeProperty(String name)
removeProperty in interface ContainerRequestContextpublic PropertiesDelegate getPropertiesDelegate()
public UriInfo getUriInfo()
getUriInfo in interface ContainerRequestContextpublic void setUriInfo(UriInfo uriInfo)
UriInfo instance.uriInfo - request scoped UriInfo instance.public URI getBaseUri()
public URI getRequestUri()
public void setRequestUri(URI requestUri) throws IllegalStateException
setRequestUri in interface ContainerRequestContextIllegalStateExceptionpublic void setRequestUri(URI baseUri, URI requestUri) throws IllegalStateException
setRequestUri in interface ContainerRequestContextIllegalStateExceptionpublic String getPath(boolean decode)
decode - controls whether sequences of escaped octets are decoded
(true) or not (false).public String getMethod()
getMethod in interface ContainerRequestContextgetMethod in interface Requestpublic void setMethod(String method) throws IllegalStateException
setMethod in interface ContainerRequestContextIllegalStateExceptionpublic void setMethodWithoutException(String method)
setMethod(String) but does not throw IllegalStateException if the method is invoked in other than
pre-matching phase.method - HTTP method.public SecurityContext getSecurityContext()
getSecurityContext in interface ContainerRequestContextpublic void setSecurityContext(SecurityContext context)
setSecurityContext in interface ContainerRequestContextpublic Request getRequest()
getRequest in interface ContainerRequestContextpublic void abortWith(Response response)
abortWith in interface ContainerRequestContextpublic Response getAbortResponse()
null otherwise.null otherwise.public Map<String,Cookie> getCookies()
getCookies in interface ContainerRequestContextgetCookies in interface HttpHeaderspublic List<MediaType> getAcceptableMediaTypes()
getAcceptableMediaTypes in interface ContainerRequestContextgetAcceptableMediaTypes in interface HttpHeaderspublic List<Locale> getAcceptableLanguages()
getAcceptableLanguages in interface ContainerRequestContextgetAcceptableLanguages in interface HttpHeaderspublic Variant selectVariant(List<Variant> variants) throws IllegalArgumentException
selectVariant in interface RequestIllegalArgumentExceptionpublic String getVaryValue()
null if no value is to be set.null otherwise.public Response.ResponseBuilder evaluatePreconditions(EntityTag eTag)
evaluatePreconditions in interface Requestpublic Response.ResponseBuilder evaluatePreconditions(Date lastModified)
evaluatePreconditions in interface Requestpublic Response.ResponseBuilder evaluatePreconditions(Date lastModified, EntityTag eTag)
evaluatePreconditions in interface Requestpublic Response.ResponseBuilder evaluatePreconditions()
evaluatePreconditions in interface Requestpublic List<String> getRequestHeader(String name)
getRequestHeaders().get(name).getRequestHeader in interface HttpHeadersname - the header name, case insensitive.IllegalStateException - if called outside the scope of a request.public MultivaluedMap<String,String> getRequestHeaders()
null.getRequestHeaders in interface HttpHeadersIllegalStateException - if called outside the scope of a request.Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.