public class PreMatchContainerRequestContext extends Object implements SuspendableContainerRequestContext
| Modifier and Type | Field and Description |
|---|---|
protected HttpRequest |
httpRequest |
protected Response |
response |
| Constructor and Description |
|---|
PreMatchContainerRequestContext(HttpRequest request)
Deprecated.
|
PreMatchContainerRequestContext(HttpRequest request,
ContainerRequestFilter[] requestFilters,
Supplier<BuiltResponse> continuation) |
| Modifier and Type | Method and Description |
|---|---|
void |
abortWith(Response response)
Abort the filter chain with a response.
|
BuiltResponse |
filter() |
List<Locale> |
getAcceptableLanguages()
Get a list of languages that are acceptable for the response.
|
List<MediaType> |
getAcceptableMediaTypes()
Get a list of media types that are acceptable for the response.
|
Map<String,Cookie> |
getCookies()
Get any cookies that accompanied the request.
|
Date |
getDate()
Get message date.
|
InputStream |
getEntityStream()
Get the entity input stream.
|
MultivaluedMap<String,String> |
getHeaders()
Get the mutable request headers multivalued map.
|
String |
getHeaderString(String name)
Get a message header as a single string value.
|
HttpRequest |
getHttpRequest() |
Locale |
getLanguage()
Get the language of the entity.
|
int |
getLength()
Get Content-Length value.
|
MediaType |
getMediaType()
Get the media type of the entity.
|
String |
getMethod()
Get the request method.
|
Object |
getProperty(String name)
Returns the property with the given name registered in the current request/response
exchange context, or
null if there is no property by that name. |
Collection<String> |
getPropertyNames()
Returns an immutable
collection containing the property
names available within the context of the current request/response exchange context. |
Request |
getRequest()
Get the injectable request information.
|
Response |
getResponseAbortedWith() |
SecurityContext |
getSecurityContext()
Get the injectable security context information for the current request.
|
UriInfo |
getUriInfo()
Get request URI information.
|
boolean |
hasEntity()
Check if there is a non-empty entity input stream available in the request
message.
|
void |
removeProperty(String name)
Removes a property with the given name from the current request/response
exchange context.
|
void |
resume()
Resumes the current request, and proceeds to the next request filter, if any,
or to the resource method.
|
void |
resume(Throwable t)
Aborts the current request with the given exception.
|
void |
setEntityStream(InputStream entityStream)
Set a new entity input stream.
|
void |
setMethod(String method)
Set the request method.
|
void |
setProperty(String name,
Object object)
Binds an object to a given property name in the current request/response
exchange context.
|
void |
setRequestUri(URI requestUri)
Set a new request URI using the current base URI of the application to
resolve the application-specific request URI part.
|
void |
setRequestUri(URI baseUri,
URI requestUri)
Set a new request URI using a new base URI to resolve the application-specific
request URI part.
|
void |
setSecurityContext(SecurityContext context)
Set a new injectable security context information for the current request.
|
boolean |
startedContinuation() |
void |
suspend()
Suspends the current request.
|
protected final HttpRequest httpRequest
protected Response response
@Deprecated public PreMatchContainerRequestContext(HttpRequest request)
public PreMatchContainerRequestContext(HttpRequest request, ContainerRequestFilter[] requestFilters, Supplier<BuiltResponse> continuation)
public HttpRequest getHttpRequest()
public Response getResponseAbortedWith()
public Object getProperty(String name)
ContainerRequestContextnull if there is no property by that name.
A property allows a JAX-RS filters and interceptors to exchange additional custom information not already provided by this interface.
A list of supported properties can be retrieved using ContainerRequestContext.getPropertyNames().
Custom property names should follow the same convention as package names.
In a Servlet container, the properties are synchronized with the ServletRequest
and expose all the attributes available in the ServletRequest. Any modifications
of the properties are also reflected in the set of properties of the associated
ServletRequest.
getProperty in interface ContainerRequestContextname - a String specifying the name of the property.Object containing the value of the property, or
null if no property exists matching the given name.ContainerRequestContext.getPropertyNames()public Collection<String> getPropertyNames()
ContainerRequestContextcollection containing the property
names available within the context of the current request/response exchange context.
Use the ContainerRequestContext.getProperty(java.lang.String) method with a property name to get the value of
a property.
In a Servlet container, the properties are synchronized with the ServletRequest
and expose all the attributes available in the ServletRequest. Any modifications
of the properties are also reflected in the set of properties of the associated
ServletRequest.
getPropertyNames in interface ContainerRequestContextcollection of property names.ContainerRequestContext.getProperty(java.lang.String)public void setProperty(String name, Object object)
ContainerRequestContextA property allows a JAX-RS filters and interceptors to exchange additional custom information not already provided by this interface.
A list of supported properties can be retrieved using ContainerRequestContext.getPropertyNames().
Custom property names should follow the same convention as package names.
If a null value is passed, the effect is the same as calling the
ContainerRequestContext.removeProperty(String) method.
In a Servlet container, the properties are synchronized with the ServletRequest
and expose all the attributes available in the ServletRequest. Any modifications
of the properties are also reflected in the set of properties of the associated
ServletRequest.
setProperty in interface ContainerRequestContextname - a String specifying the name of the property.object - an Object representing the property to be bound.public void removeProperty(String name)
ContainerRequestContextContainerRequestContext.getProperty(java.lang.String)
to retrieve the property value will return null.
In a Servlet container, the properties are synchronized with the ServletRequest
and expose all the attributes available in the ServletRequest. Any modifications
of the properties are also reflected in the set of properties of the associated
ServletRequest.
removeProperty in interface ContainerRequestContextname - a String specifying the name of the property to be removed.public UriInfo getUriInfo()
ContainerRequestContextsetRequestUri(...) methods will be reflected in the previously
returned UriInfo instance.getUriInfo in interface ContainerRequestContextpublic void setRequestUri(URI requestUri) throws IllegalStateException
ContainerRequestContext
Note that the method is usable only in pre-matching filters, prior to the resource
matching occurs. Trying to invoke the method in a filter bound to a resource method
results in an IllegalStateException being thrown.
setRequestUri in interface ContainerRequestContextrequestUri - new URI of the request.IllegalStateException - in case the method is not invoked from a pre-matching
request filter.ContainerRequestContext.setRequestUri(java.net.URI, java.net.URI)public void setRequestUri(URI baseUri, URI requestUri) throws IllegalStateException
ContainerRequestContext
Note that the method is usable only in pre-matching filters, prior to the resource
matching occurs. Trying to invoke the method in a filter bound to a resource method
results in an IllegalStateException being thrown.
setRequestUri in interface ContainerRequestContextbaseUri - base URI that will be used to resolve the application-specific
part of the request URI.requestUri - new URI of the request.IllegalStateException - in case the method is not invoked from a pre-matching
request filter.ContainerRequestContext.setRequestUri(java.net.URI)public String getMethod()
ContainerRequestContextgetMethod in interface ContainerRequestContextHttpMethodpublic void setMethod(String method)
ContainerRequestContext
Note that the method is usable only in pre-matching filters, prior to the resource
matching occurs. Trying to invoke the method in a filter bound to a resource method
results in an IllegalStateException being thrown.
setMethod in interface ContainerRequestContextmethod - new request method.HttpMethodpublic MultivaluedMap<String,String> getHeaders()
ContainerRequestContextgetHeaders in interface ContainerRequestContextContainerRequestContext.getHeaderString(String)public Date getDate()
ContainerRequestContextgetDate in interface ContainerRequestContextnull if not present.public Locale getLanguage()
ContainerRequestContextgetLanguage in interface ContainerRequestContextnull if not specifiedpublic int getLength()
ContainerRequestContextgetLength in interface ContainerRequestContext-1.public MediaType getMediaType()
ContainerRequestContextgetMediaType in interface ContainerRequestContextnull if not specified (e.g. there's no
request entity).public List<MediaType> getAcceptableMediaTypes()
ContainerRequestContextgetAcceptableMediaTypes in interface ContainerRequestContextpublic List<Locale> getAcceptableLanguages()
ContainerRequestContextgetAcceptableLanguages in interface ContainerRequestContextpublic Map<String,Cookie> getCookies()
ContainerRequestContextgetCookies in interface ContainerRequestContextCookie.public boolean hasEntity()
ContainerRequestContexttrue if the entity is present, returns
false otherwise.hasEntity in interface ContainerRequestContexttrue if there is an entity present in the message,
false otherwise.public InputStream getEntityStream()
ContainerRequestContextgetEntityStream in interface ContainerRequestContextpublic void setEntityStream(InputStream entityStream)
ContainerRequestContextsetEntityStream in interface ContainerRequestContextentityStream - new entity input stream.public SecurityContext getSecurityContext()
ContainerRequestContextSecurityContext.getUserPrincipal() must return null
if the current request has not been authenticated.getSecurityContext in interface ContainerRequestContextpublic void setSecurityContext(SecurityContext context)
ContainerRequestContextSecurityContext.getUserPrincipal() must return null
if the current request has not been authenticated.setSecurityContext in interface ContainerRequestContextcontext - new injectable request security context information.public Request getRequest()
ContainerRequestContextgetRequest in interface ContainerRequestContextpublic String getHeaderString(String name)
ContainerRequestContextgetHeaderString in interface ContainerRequestContextname - the message header.null is returned. If the message header is present but has no
value then the empty string is returned. If the message header is present
more than once then the values of joined together and separated by a ','
character.ContainerRequestContext.getHeaders()public void suspend()
SuspendableContainerRequestContextSuspendableContainerRequestContext.resume() or aborted with SuspendableContainerRequestContext.resume(Throwable) or
ContainerRequestContext.abortWith(javax.ws.rs.core.Response).suspend in interface SuspendableContainerRequestContextpublic void abortWith(Response response)
ContainerRequestContextabortWith in interface ContainerRequestContextresponse - response to be sent back to the client.public void resume()
SuspendableContainerRequestContextresume in interface SuspendableContainerRequestContextpublic void resume(Throwable t)
SuspendableContainerRequestContextresume in interface SuspendableContainerRequestContextt - the exception to send back to the client, as mapped by the application.public BuiltResponse filter()
public boolean startedContinuation()
Copyright © 2018 JBoss by Red Hat. All rights reserved.