public interface ClientRequestContext
Modifier and Type | Method and Description |
---|---|
void |
abortWith(Response response)
Abort the filter chain with a response.
|
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.
|
Client |
getClient()
Get the client instance associated with the request.
|
Configuration |
getConfiguration()
Get the immutable configuration of the request.
|
Map<String,Cookie> |
getCookies()
Get any cookies that accompanied the request.
|
Date |
getDate()
Get message date.
|
Object |
getEntity()
Get the message entity Java instance.
|
Annotation[] |
getEntityAnnotations()
Get the annotations attached to the entity instance.
|
Class<?> |
getEntityClass()
Get the raw entity type information.
|
OutputStream |
getEntityStream()
Get the entity output stream.
|
Type |
getEntityType()
Get the generic entity type information.
|
MultivaluedMap<String,Object> |
getHeaders()
Get the mutable request headers multivalued map.
|
String |
getHeaderString(String name)
Get a message header as a single string value.
|
Locale |
getLanguage()
Get the language of the entity.
|
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. |
MultivaluedMap<String,String> |
getStringHeaders()
Get a string view of header values associated with the message.
|
URI |
getUri()
Get the request URI.
|
boolean |
hasEntity()
Check if there is an entity available in the request.
|
void |
removeProperty(String name)
Removes a property with the given name from the current request/response
exchange context.
|
void |
setEntity(Object entity)
Set a new message entity.
|
void |
setEntity(Object entity,
Annotation[] annotations,
MediaType mediaType)
Set a new message entity, including the attached annotations and the media type.
|
void |
setEntityStream(OutputStream outputStream)
Set a new entity output 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 |
setUri(URI uri)
Set a new request URI.
|
Object getProperty(String name)
null
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 getPropertyNames()
.
Custom property names should follow the same convention as package names.
name
- 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.getPropertyNames()
Collection<String> getPropertyNames()
collection
containing the property names
available within the context of the current request/response exchange context.
Use the getProperty(java.lang.String)
method with a property name to get the value of
a property.
collection
of property names.getProperty(java.lang.String)
void setProperty(String name, Object object)
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 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
removeProperty(String)
method.
name
- a String
specifying the name of the property.object
- an Object
representing the property to be bound.void removeProperty(String name)
getProperty(java.lang.String)
to retrieve the property value will return null
.name
- a String
specifying the name of the property to be removed.URI getUri()
void setUri(URI uri)
uri
- new request URI.String getMethod()
HttpMethod
void setMethod(String method)
method
- new request method.HttpMethod
MultivaluedMap<String,Object> getHeaders()
getStringHeaders()
,
getHeaderString(String)
MultivaluedMap<String,String> getStringHeaders()
headers map
are reflected
in this view.
The method converts the non-string header values to strings using a
RuntimeDelegate.HeaderDelegate
if one is available via
RuntimeDelegate.createHeaderDelegate(java.lang.Class)
for the
class of the value or using the values toString
method if a header delegate is
not available.
getHeaders()
,
getHeaderString(String)
String getHeaderString(String name)
RuntimeDelegate.HeaderDelegate
if one is available
via RuntimeDelegate.createHeaderDelegate(java.lang.Class)
for the header value class or using its toString
method if a header
delegate is not available.name
- 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.getHeaders()
,
getStringHeaders()
Date getDate()
null
if not present.Locale getLanguage()
null
if not specifiedMediaType getMediaType()
null
if not specified (e.g. there's no
request entity).List<MediaType> getAcceptableMediaTypes()
List<Locale> getAcceptableLanguages()
Map<String,Cookie> getCookies()
Cookie
.boolean hasEntity()
true
if the entity is present, returns
false
otherwise.true
if there is an entity present in the message,
false
otherwise.Object getEntity()
null
if the message does not contain an entity.null
if message does not contain an
entity body.Class<?> getEntityClass()
Type getEntityType()
void setEntity(Object entity)
annotations
and media type
are preserved.
It is the callers responsibility to wrap the actual entity with
GenericEntity
if preservation of its generic
type is required.
entity
- entity object.setEntity(Object, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)
,
MessageBodyWriter
void setEntity(Object entity, Annotation[] annotations, MediaType mediaType)
It is the callers responsibility to wrap the actual entity with
GenericEntity
if preservation of its generic
type is required.
entity
- entity object.annotations
- annotations attached to the entity instance.mediaType
- entity media type.setEntity(Object)
,
MessageBodyWriter
Annotation[] getEntityAnnotations()
Note that the returned annotations array contains only those annotations
explicitly attached to entity instance (such as the ones attached using
Entity.Entity(Object, javax.ws.rs.core.MediaType, java.lang.annotation.Annotation[])
method).
The entity instance annotations array does not include annotations declared on the entity
implementation class or its ancestors.
OutputStream getEntityStream()
void setEntityStream(OutputStream outputStream)
outputStream
- new entity output stream.Client getClient()
Configuration getConfiguration()
void abortWith(Response response)
response
- response to be sent back to the client.Copyright © 2016 JBoss by Red Hat. All rights reserved.