org.glassfish.jersey.client
Class ClientRequest

java.lang.Object
  extended by org.glassfish.jersey.message.internal.OutboundMessageContext
      extended by org.glassfish.jersey.client.ClientRequest
All Implemented Interfaces:
ClientRequestContext

public class ClientRequest
extends OutboundMessageContext
implements ClientRequestContext

Jersey client request context.

Author:
Marek Potociar (marek.potociar at oracle.com)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.glassfish.jersey.message.internal.OutboundMessageContext
OutboundMessageContext.StreamProvider
 
Constructor Summary
ClientRequest(ClientRequest original)
          Copy constructor.
ClientRequest(java.net.URI requestUri, ClientConfig configuration, PropertiesDelegate propertiesDelegate)
          Create new Jersey client request context.
 
Method Summary
 void abortWith(Response response)
           
 void accept(MediaType... types)
          Add new accepted types to the message headers.
 void accept(java.lang.String... types)
          Add new accepted types to the message headers.
 void acceptLanguage(java.util.Locale... locales)
          Add new accepted languages to the message headers.
 void acceptLanguage(java.lang.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(java.lang.String encoding)
          Set message encoding.
 Response getAbortResponse()
          Get the request filter chain aborting response if set, or null otherwise.
 JerseyClient getClient()
           
 ClientConfig getConfiguration()
           
 java.util.Map<java.lang.String,Cookie> getCookies()
           
 java.lang.String getMethod()
           
 java.lang.Object getProperty(java.lang.String name)
           
 java.util.Enumeration<java.lang.String> getPropertyNames()
           
 java.net.URI getUri()
           
 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(java.util.Locale language)
          Set message language.
 void language(java.lang.String language)
          Set message language.
 void removeProperty(java.lang.String name)
           
 void setMethod(java.lang.String method)
           
 void setProperty(java.lang.String name, java.lang.Object object)
           
 void setUri(java.net.URI uri)
           
 void setWorkers(MessageBodyWorkers workers)
          Set the message body workers associated with the request.
 void type(MediaType type)
          Set message content type.
 void type(java.lang.String type)
          Set message content type.
 void variant(Variant variant)
          Set message content variant (type, language and encoding).
 
Methods inherited from class org.glassfish.jersey.message.internal.OutboundMessageContext
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, setStreamProvider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.ws.rs.client.ClientRequestContext
getAcceptableLanguages, getAcceptableMediaTypes, getDate, getEntity, getEntityAnnotations, getEntityClass, getEntityStream, getEntityType, getHeaders, getHeaderString, getLanguage, getMediaType, getStringHeaders, hasEntity, setEntity, setEntityStream
 

Constructor Detail

ClientRequest

public ClientRequest(java.net.URI requestUri,
                     ClientConfig configuration,
                     PropertiesDelegate propertiesDelegate)
Create new Jersey client request context.

Parameters:
requestUri - request Uri.
configuration - request configuration.
propertiesDelegate - properties delegate.

ClientRequest

public ClientRequest(ClientRequest original)
Copy constructor.

Parameters:
original - original instance.
Method Detail

getProperty

public java.lang.Object getProperty(java.lang.String name)
Specified by:
getProperty in interface ClientRequestContext

getPropertyNames

public java.util.Enumeration<java.lang.String> getPropertyNames()
Specified by:
getPropertyNames in interface ClientRequestContext

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object object)
Specified by:
setProperty in interface ClientRequestContext

removeProperty

public void removeProperty(java.lang.String name)
Specified by:
removeProperty in interface ClientRequestContext

getUri

public java.net.URI getUri()
Specified by:
getUri in interface ClientRequestContext

setUri

public void setUri(java.net.URI uri)
Specified by:
setUri in interface ClientRequestContext

getMethod

public java.lang.String getMethod()
Specified by:
getMethod in interface ClientRequestContext

setMethod

public void setMethod(java.lang.String method)
Specified by:
setMethod in interface ClientRequestContext

getClient

public JerseyClient getClient()
Specified by:
getClient in interface ClientRequestContext

abortWith

public void abortWith(Response response)
Specified by:
abortWith in interface ClientRequestContext

getAbortResponse

public Response getAbortResponse()
Get the request filter chain aborting response if set, or null otherwise.

Returns:
request filter chain aborting response if set, or null otherwise.

getConfiguration

public ClientConfig getConfiguration()
Specified by:
getConfiguration in interface ClientRequestContext

getCookies

public java.util.Map<java.lang.String,Cookie> getCookies()
Specified by:
getCookies in interface ClientRequestContext

getWorkers

public MessageBodyWorkers getWorkers()
Get the message body workers associated with the request.

Returns:
message body workers.

setWorkers

public void setWorkers(MessageBodyWorkers workers)
Set the message body workers associated with the request.

Parameters:
workers - message body workers.

accept

public void accept(MediaType... types)
Add new accepted types to the message headers.

Parameters:
types - accepted types to be added.

accept

public void accept(java.lang.String... types)
Add new accepted types to the message headers.

Parameters:
types - accepted types to be added.

acceptLanguage

public void acceptLanguage(java.util.Locale... locales)
Add new accepted languages to the message headers.

Parameters:
locales - accepted languages to be added.

acceptLanguage

public void acceptLanguage(java.lang.String... locales)
Add new accepted languages to the message headers.

Parameters:
locales - accepted languages to be added.

cookie

public void cookie(Cookie cookie)
Add new cookie to the message headers.

Parameters:
cookie - cookie to be added.

cacheControl

public void cacheControl(CacheControl cacheControl)
Add new cache control entry to the message headers.

Parameters:
cacheControl - cache control entry to be added.

encoding

public void encoding(java.lang.String encoding)
Set message encoding.

Parameters:
encoding - message encoding to be set.

language

public void language(java.lang.String language)
Set message language.

Parameters:
language - message language to be set.

language

public void language(java.util.Locale language)
Set message language.

Parameters:
language - message language to be set.

type

public void type(MediaType type)
Set message content type.

Parameters:
type - message content type to be set.

type

public void type(java.lang.String type)
Set message content type.

Parameters:
type - message content type to be set.

variant

public void variant(Variant variant)
Set message content variant (type, language and encoding).

Parameters:
variant - message content content variant (type, language and encoding) to be set.

isAsynchronous

public boolean isAsynchronous()
Returns true if the request is called asynchronously using AsyncInvoker

Returns:
True if the request is asynchronous; false otherwise.


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.