public class ClientRequest extends OutboundMessageContext implements ClientRequestContext
OutboundMessageContext.StreamProvider| Modifier | Constructor and Description |
|---|---|
|
ClientRequest(ClientRequest original)
Copy constructor.
|
protected |
ClientRequest(URI requestUri,
ClientConfig clientConfig,
PropertiesDelegate propertiesDelegate)
Create new Jersey client request context.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abortWith(Response response)
Abort the filter chain with a response.
|
void |
accept(MediaType... types)
Add new accepted types to the message headers.
|
void |
accept(String... types)
Add new accepted types to the message headers.
|
void |
acceptLanguage(Locale... locales)
Add new accepted languages to the message headers.
|
void |
acceptLanguage(String... locales)
Add new accepted languages to the message headers.
|
void |
cacheControl(CacheControl cacheControl)
Add new cache control entry to the message headers.
|
void |
cookie(Cookie cookie)
Add new cookie to the message headers.
|
void |
encoding(String encoding)
Set message encoding.
|
Response |
getAbortResponse()
Get the request filter chain aborting response if set, or
null otherwise. |
JerseyClient |
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.
|
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. |
URI |
getUri()
Get the request URI.
|
MessageBodyWorkers |
getWorkers()
Get the message body workers associated with the request.
|
boolean |
isAsynchronous()
Returns true if the request is called asynchronously using
AsyncInvoker |
void |
language(Locale language)
Set message language.
|
void |
language(String language)
Set message language.
|
void |
removeProperty(String name)
Removes a property with the given name from the current request/response
exchange context.
|
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.
|
void |
setWorkers(MessageBodyWorkers workers)
Set the message body workers associated with the request.
|
void |
type(MediaType type)
Set message content type.
|
void |
type(String type)
Set message content type.
|
void |
variant(Variant variant)
Set message content variant (type, language and encoding).
|
close, commitStream, getAcceptableLanguages, getAcceptableMediaTypes, getAllowedMethods, getDate, getEntity, getEntityAnnotations, getEntityClass, getEntityStream, getEntityTag, getEntityType, getHeaders, getHeaderString, getLanguage, getLastModified, getLength, getLink, getLinkBuilder, getLinks, getLocation, getMediaType, getRequestCookies, getResponseCookies, getStringHeaders, hasEntity, hasLink, isCommitted, replaceHeaders, setEntity, setEntity, setEntity, setEntity, setEntityAnnotations, setEntityStream, setEntityType, setMediaType, setStreamProviderclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAcceptableLanguages, getAcceptableMediaTypes, getDate, getEntity, getEntityAnnotations, getEntityClass, getEntityStream, getEntityType, getHeaders, getHeaderString, getLanguage, getMediaType, getStringHeaders, hasEntity, setEntity, setEntityStreamprotected ClientRequest(URI requestUri, ClientConfig clientConfig, PropertiesDelegate propertiesDelegate)
requestUri - request Uri.clientConfig - request configuration.propertiesDelegate - properties delegate.public ClientRequest(ClientRequest original)
original - original instance.public Object getProperty(String name)
ClientRequestContextnull 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 ClientRequestContext.getPropertyNames().
Custom property names should follow the same convention as package names.
getProperty in interface ClientRequestContextname - 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.ClientRequestContext.getPropertyNames()public Collection<String> getPropertyNames()
ClientRequestContextcollection containing the property names
available within the context of the current request/response exchange context.
Use the ClientRequestContext.getProperty(java.lang.String) method with a property name to get the value of
a property.
getPropertyNames in interface ClientRequestContextcollection of property names.ClientRequestContext.getProperty(java.lang.String)public void setProperty(String name, Object object)
ClientRequestContextA 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 ClientRequestContext.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
ClientRequestContext.removeProperty(String) method.
setProperty in interface ClientRequestContextname - a String specifying the name of the property.object - an Object representing the property to be bound.public void removeProperty(String name)
ClientRequestContextClientRequestContext.getProperty(java.lang.String)
to retrieve the property value will return null.removeProperty in interface ClientRequestContextname - a String specifying the name of the property to be removed.public URI getUri()
ClientRequestContextgetUri in interface ClientRequestContextpublic void setUri(URI uri)
ClientRequestContextsetUri in interface ClientRequestContexturi - new request URI.public String getMethod()
ClientRequestContextgetMethod in interface ClientRequestContextHttpMethodpublic void setMethod(String method)
ClientRequestContextsetMethod in interface ClientRequestContextmethod - new request method.HttpMethodpublic JerseyClient getClient()
ClientRequestContextgetClient in interface ClientRequestContextpublic void abortWith(Response response)
ClientRequestContextabortWith in interface ClientRequestContextresponse - response to be sent back to the client.public Response getAbortResponse()
null otherwise.null otherwise.public Configuration getConfiguration()
ClientRequestContextgetConfiguration in interface ClientRequestContextpublic Map<String,Cookie> getCookies()
ClientRequestContextgetCookies in interface ClientRequestContextCookie.public MessageBodyWorkers getWorkers()
public void setWorkers(MessageBodyWorkers workers)
workers - message body workers.public void accept(MediaType... types)
types - accepted types to be added.public void accept(String... types)
types - accepted types to be added.public void acceptLanguage(Locale... locales)
locales - accepted languages to be added.public void acceptLanguage(String... locales)
locales - accepted languages to be added.public void cookie(Cookie cookie)
cookie - cookie to be added.public void cacheControl(CacheControl cacheControl)
cacheControl - cache control entry to be added.public void encoding(String encoding)
encoding - message encoding to be set.public void language(String language)
language - message language to be set.public void language(Locale language)
language - message language to be set.public void type(MediaType type)
type - message content type to be set.public void type(String type)
type - message content type to be set.public void variant(Variant variant)
variant - message content content variant (type, language and encoding)
to be set.public boolean isAsynchronous()
AsyncInvokerCopyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.