Apache CXF API

org.apache.cxf.jaxrs.client
Class WebClient

java.lang.Object
  extended by org.apache.cxf.jaxrs.client.AbstractClient
      extended by org.apache.cxf.jaxrs.client.WebClient
All Implemented Interfaces:
Client

public class WebClient
extends AbstractClient

Http-centric web client


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.cxf.jaxrs.client.AbstractClient
AbstractClient.AbstractBodyWriter
 
Field Summary
 
Fields inherited from class org.apache.cxf.jaxrs.client.AbstractClient
cfg, HTTP_SCHEME, KEEP_CONDUIT_ALIVE, REQUEST_CONTEXT, RESPONSE_CONTEXT
 
Constructor Summary
protected WebClient(ClientState state)
           
protected WebClient(String baseAddress)
           
protected WebClient(URI baseURI)
           
 
Method Summary
 WebClient accept(javax.ws.rs.core.MediaType... types)
          sets HTTP Accept header
 WebClient accept(String... types)
          sets HTTP Accept header
 WebClient acceptEncoding(String... encodings)
          sets HTTP Accept-Encoding header
 WebClient acceptLanguage(String... languages)
          sets HTTP Accept-Language header
 javax.ws.rs.client.AsyncInvoker async()
           
 WebClient back(boolean fast)
          Goes back
static Client client(Object object)
          Converts object to Client
 WebClient cookie(javax.ws.rs.core.Cookie cookie)
          sets HTTP Cookie header
static WebClient create(String baseAddress)
          Creates WebClient
static WebClient create(String baseURI, boolean threadSafe)
          Creates WebClient
static WebClient create(String baseAddress, List<?> providers)
          Creates WebClient
static WebClient create(String baseAddress, List<?> providers, boolean threadSafe)
          Creates WebClient
static WebClient create(String baseAddress, List<?> providers, List<? extends Feature> features, String configLocation)
          Creates WebClient with a list of custom features
static WebClient create(String baseAddress, List<?> providers, long timeToKeepState)
          Creates a thread safe WebClient
static WebClient create(String baseAddress, List<?> providers, String configLocation)
          Creates WebClient
static WebClient create(String baseAddress, List<?> providers, String username, String password, String configLocation)
          Creates WebClient which will do basic authentication
static WebClient create(String baseAddress, String configLocation)
          Creates WebClient
static WebClient create(String baseAddress, String username, String password, String configLocation)
          Creates WebClient which will do basic authentication
static WebClient create(URI baseURI)
          Creates WebClient
 javax.ws.rs.core.Response delete()
          Does HTTP DELETE invocation
protected  javax.ws.rs.core.Response doChainedInvocation(String httpMethod, javax.ws.rs.core.MultivaluedMap<String,String> headers, Object body, Class<?> requestClass, Type inType, Annotation[] inAnns, Class<?> respClass, Type outType, Exchange exchange, Map<String,Object> invContext)
           
protected  javax.ws.rs.core.Response doInvoke(String httpMethod, Object body, Class<?> requestClass, Type inGenericType, Class<?> responseClass, Type outGenericType)
           
protected  javax.ws.rs.core.Response doInvoke(String httpMethod, Object body, Type inGenericType, Class<?> responseClass, Type outGenericType)
           
protected
<T> Future<T>
doInvokeAsync(String httpMethod, Object body, Class<?> requestClass, Type inType, Class<?> respClass, Type outType, javax.ws.rs.client.InvocationCallback<T> callback)
           
protected
<T> Future<T>
doInvokeAsyncCallback(String httpMethod, Object body, Class<?> requestClass, Type inType, javax.ws.rs.client.InvocationCallback<T> callback)
           
protected  javax.ws.rs.core.Response doResponse(Message m, Class<?> responseClass, Type outGenericType)
           
 WebClient encoding(String encoding)
          sets HTTP Content-Encoding header
 javax.ws.rs.core.Response form(javax.ws.rs.core.Form form)
          Posts form data
 javax.ws.rs.core.Response form(Map<String,List<Object>> values)
          Posts form data
 WebClient fragment(String name)
          Updates the current URI fragment
static WebClient fromClient(Client client)
          Creates WebClient, baseURI will be set to Client currentURI
static WebClient fromClient(Client client, boolean inheritHeaders)
          Creates WebClient, baseURI will be set to Client currentURI
 javax.ws.rs.core.Response get()
          Does HTTP GET invocation
<T> T
get(Class<T> responseClass)
          Does HTTP GET invocation and returns typed response object
<T> T
get(javax.ws.rs.core.GenericType<T> responseType)
          Does HTTP GET invocation and returns typed response object
<T> Future<T>
get(javax.ws.rs.client.InvocationCallback<T> callback)
          Does HTTP Async GET invocation and returns Future.
<T> Collection<? extends T>
getCollection(Class<T> memberClass)
          Does HTTP GET invocation and returns a collection of typed objects
static ClientConfiguration getConfig(Object client)
          Retrieves ClientConfiguration
protected  javax.ws.rs.core.Response handleResponse(Message outMessage, Class<?> responseClass, Type genericType)
           
 javax.ws.rs.core.Response head()
          Does HTTP HEAD invocation
 WebClient header(String name, Object... values)
          Sets arbitrary HTTP Header
 WebClient headers(javax.ws.rs.core.MultivaluedMap<String,String> map)
          Sets HTTP Headers
 javax.ws.rs.core.Response invoke(String httpMethod, Object body)
          Does HTTP invocation
<T> T
invoke(String httpMethod, Object body, Class<?> requestClass, Class<T> responseClass)
          Does HTTP invocation and returns types response object
<T> T
invoke(String httpMethod, Object body, Class<T> responseClass)
          Does HTTP invocation and returns types response object
<T> T
invoke(String httpMethod, Object body, javax.ws.rs.core.GenericType<T> responseType)
          Does HTTP invocation and returns types response object
<T> Collection<? extends T>
invokeAndGetCollection(String httpMethod, Object body, Class<T> memberClass)
          Does HTTP invocation and returns a collection of typed objects
 WebClient language(String language)
          sets HTTP Content-Language header
 WebClient match(javax.ws.rs.core.EntityTag tag, boolean ifNot)
          sets HTTP If-Match or If-None-Match header
 WebClient matrix(String name, Object... values)
          Updates the current URI matrix parameters
 WebClient modified(Date date, boolean ifNot)
          sets HTTP If-Modified-Since or If-Unmodified-Since header
 javax.ws.rs.core.Response options()
          Does HTTP OPTIONS invocation
 WebClient path(Object path)
          Updates the current URI path
 WebClient path(String path, Object... values)
          Updates the current URI path with path segment which may contain template variables
 javax.ws.rs.core.Response post(Object body)
          Does HTTP POST invocation
<T> T
post(Object body, Class<T> responseClass)
          Does HTTP POST invocation and returns typed response object
<T> T
post(Object body, javax.ws.rs.core.GenericType<T> responseType)
          Does HTTP POST invocation and returns typed response object
<T> Future<T>
post(Object body, javax.ws.rs.client.InvocationCallback<T> callback)
          Does HTTP Async POST invocation and returns Future.
<T> Collection<? extends T>
postAndGetCollection(Object body, Class<T> memberClass)
          Posts request body and returns a collection of typed objects
<T1,T2> Collection<? extends T2>
postAndGetCollection(Object collection, Class<T1> memberClass, Class<T2> responseClass)
          Posts collection of typed objects and returns a collection of typed objects
<T> javax.ws.rs.core.Response
postCollection(Object collection, Class<T> memberClass)
          Posts a collection of typed objects
<T1,T2> T2
postCollection(Object collection, Class<T1> memberClass, Class<T2> responseClass)
          Posts a collection of typed objects
<T> Collection<? extends T>
postObjectGetCollection(Object body, Class<T> responseClass)
          Posts the object and returns a collection of typed objects
 javax.ws.rs.core.Response put(Object body)
          Does HTTP PUT invocation
<T> T
put(Object body, Class<T> responseClass)
          Does HTTP PUT invocation and returns typed response object
<T> T
put(Object body, javax.ws.rs.core.GenericType<T> responseType)
          Does HTTP PUT invocation and returns typed response object
<T> Future<T>
put(Object body, javax.ws.rs.client.InvocationCallback<T> callback)
          Does HTTP Async PUT invocation and returns Future.
 WebClient query(String name, Object... values)
          Updates the current URI query parameters
 WebClient replaceHeader(String headerName, String value)
          Replaces the header value with the new values.
 WebClient replacePath(String path)
          Replaces the current path with the new value.
 WebClient replaceQuery(String queryString)
          Replaces the current query with the new value.
 WebClient replaceQueryParam(String queryParam, Object... value)
          Replaces the current query with the new value.
 WebClient reset()
          Resets the headers and response state if any
 WebClient resetQuery()
          Resets the current query
protected  Object retryInvoke(URI newRequestURI, javax.ws.rs.core.MultivaluedMap<String,String> headers, Object body, Exchange exchange, Map<String,Object> invContext)
           
 javax.ws.rs.client.SyncInvoker sync()
           
 WebClient to(String newAddress, boolean forward)
          Moves WebClient to a new baseURI or forwards to new currentURI
 WebClient type(javax.ws.rs.core.MediaType ct)
          sets HTTP Content-Type header
 WebClient type(String type)
          sets HTTP Content-Type header
 
Methods inherited from class org.apache.cxf.jaxrs.client.AbstractClient
addMatrixQueryParamsToBuilder, calculateNewRequestURI, checkClientException, checkIfBodyEmpty, close, completeExchange, convertParamValue, convertToWebApplicationException, createExchange, createMessage, doRunInterceptorChain, getBaseURI, getConfiguration, getContentsList, getCurrentBuilder, getCurrentURI, getHeaders, getRequestContext, getResponse, getState, getTemplateParametersMap, parseQuotedHeaderValue, prepareConduitSelector, preProcessResult, readBody, reportMessageHandlerProblem, resetBaseAddress, resetCurrentBuilder, resetResponse, responseStreamCanBeClosed, retryInvoke, setAllHeaders, setConfiguration, setContexts, setEmptyRequestPropertyIfNeeded, setPlainOperationNameProperty, setResponseBuilder, setupInFaultObserver, setupInInterceptorChain, setupOutInterceptorChain, waitForResponseCode, writeBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebClient

protected WebClient(String baseAddress)

WebClient

protected WebClient(URI baseURI)

WebClient

protected WebClient(ClientState state)
Method Detail

create

public static WebClient create(String baseAddress)
Creates WebClient

Parameters:
baseAddress - baseAddress

create

public static WebClient create(URI baseURI)
Creates WebClient

Parameters:
baseURI - baseURI

create

public static WebClient create(String baseURI,
                               boolean threadSafe)
Creates WebClient

Parameters:
baseURI - baseURI

create

public static WebClient create(String baseAddress,
                               List<?> providers)
Creates WebClient

Parameters:
baseURI - baseURI
providers - list of providers

create

public static WebClient create(String baseAddress,
                               List<?> providers,
                               boolean threadSafe)
Creates WebClient

Parameters:
baseURI - baseURI
providers - list of providers

create

public static WebClient create(String baseAddress,
                               List<?> providers,
                               long timeToKeepState)
Creates a thread safe WebClient

Parameters:
baseURI - baseURI
providers - list of providers
timeToKeepState - time to keep this thread safe state.

create

public static WebClient create(String baseAddress,
                               List<?> providers,
                               String configLocation)
Creates WebClient

Parameters:
baseAddress - baseAddress
providers - list of providers
configLocation - classpath location of the configuration resource, can be null
Returns:
WebClient instance

create

public static WebClient create(String baseAddress,
                               List<?> providers,
                               List<? extends Feature> features,
                               String configLocation)
Creates WebClient with a list of custom features

Parameters:
baseAddress - baseAddress
providers - list of providers
features - the features which will be applied to the client
configLocation - classpath location of the configuration resource, can be null
Returns:
WebClient instance

create

public static WebClient create(String baseAddress,
                               String configLocation)
Creates WebClient

Parameters:
baseAddress - baseAddress
configLocation - classpath location of the configuration resource, can be null
Returns:
WebClient instance

create

public static WebClient create(String baseAddress,
                               String username,
                               String password,
                               String configLocation)
Creates WebClient which will do basic authentication

Parameters:
baseAddress - baseAddress
username - username
password - password
configLocation - classpath location of the configuration resource, can be null
Returns:
WebClient instance

create

public static WebClient create(String baseAddress,
                               List<?> providers,
                               String username,
                               String password,
                               String configLocation)
Creates WebClient which will do basic authentication

Parameters:
baseAddress - baseAddress
providers - list of providers
username - username
password - password
configLocation - classpath location of the configuration resource, can be null
Returns:
WebClient instance

fromClient

public static WebClient fromClient(Client client)
Creates WebClient, baseURI will be set to Client currentURI

Parameters:
client - existing client

fromClient

public static WebClient fromClient(Client client,
                                   boolean inheritHeaders)
Creates WebClient, baseURI will be set to Client currentURI

Parameters:
client - existing client
inheritHeaders - if existing Client headers can be inherited by new client

client

public static Client client(Object object)
Converts object to Client

Parameters:
object - the object
Returns:
Client object converted to Client

getConfig

public static ClientConfiguration getConfig(Object client)
Retrieves ClientConfiguration

Parameters:
client - proxy or http-centric Client
Returns:
underlying ClientConfiguration instance

invoke

public javax.ws.rs.core.Response invoke(String httpMethod,
                                        Object body)
Does HTTP invocation

Parameters:
httpMethod - HTTP method
body - request body, can be null
Returns:
JAXRS Response, entity may hold a string representaion of error message if client or server error occured

post

public javax.ws.rs.core.Response post(Object body)
Does HTTP POST invocation

Parameters:
body - request body, can be null
Returns:
JAXRS Response

put

public javax.ws.rs.core.Response put(Object body)
Does HTTP PUT invocation

Parameters:
body - request body, can be null
Returns:
JAXRS Response

get

public javax.ws.rs.core.Response get()
Does HTTP GET invocation

Returns:
JAXRS Response

head

public javax.ws.rs.core.Response head()
Does HTTP HEAD invocation

Returns:
JAXRS Response

options

public javax.ws.rs.core.Response options()
Does HTTP OPTIONS invocation

Returns:
JAXRS Response

delete

public javax.ws.rs.core.Response delete()
Does HTTP DELETE invocation

Returns:
JAXRS Response

form

public javax.ws.rs.core.Response form(Map<String,List<Object>> values)
Posts form data

Parameters:
values - form values
Returns:
JAXRS Response

form

public javax.ws.rs.core.Response form(javax.ws.rs.core.Form form)
Posts form data

Parameters:
form - form values
Returns:
JAXRS Response

invoke

public <T> T invoke(String httpMethod,
                    Object body,
                    javax.ws.rs.core.GenericType<T> responseType)
Does HTTP invocation and returns types response object

Parameters:
httpMethod - HTTP method
body - request body, can be null
responseType - generic response type
Returns:
typed object, can be null. Response status code and headers can be obtained too, see Client.getResponse()

invoke

public <T> T invoke(String httpMethod,
                    Object body,
                    Class<T> responseClass)
Does HTTP invocation and returns types response object

Parameters:
httpMethod - HTTP method
body - request body, can be null
responseClass - expected type of response object
Returns:
typed object, can be null. Response status code and headers can be obtained too, see Client.getResponse()

invoke

public <T> T invoke(String httpMethod,
                    Object body,
                    Class<?> requestClass,
                    Class<T> responseClass)
Does HTTP invocation and returns types response object

Parameters:
httpMethod - HTTP method
body - request body, can be null
requestClass - request body class
responseClass - expected type of response object
Returns:
typed object, can be null. Response status code and headers can be obtained too, see Client.getResponse()

post

public <T> T post(Object body,
                  Class<T> responseClass)
Does HTTP POST invocation and returns typed response object

Parameters:
body - request body, can be null
responseClass - expected type of response object
Returns:
typed object, can be null. Response status code and headers can be obtained too, see Client.getResponse()

post

public <T> T post(Object body,
                  javax.ws.rs.core.GenericType<T> responseType)
Does HTTP POST invocation and returns typed response object

Parameters:
body - request body, can be null
responseType - generic response type
Returns:
typed object, can be null. Response status code and headers can be obtained too, see Client.getResponse()

post

public <T> Future<T> post(Object body,
                          javax.ws.rs.client.InvocationCallback<T> callback)
Does HTTP Async POST invocation and returns Future. Shortcut for async().post(Entity, InvocationCallback)

Parameters:
callback - invocation callback
Returns:
the future

put

public <T> T put(Object body,
                 Class<T> responseClass)
Does HTTP PUT invocation and returns typed response object

Parameters:
body - request body, can be null
responseClass - expected type of response object
Returns:
typed object, can be null. Response status code and headers can be obtained too, see Client.getResponse()

put

public <T> T put(Object body,
                 javax.ws.rs.core.GenericType<T> responseType)
Does HTTP PUT invocation and returns typed response object

Parameters:
body - request body, can be null
responseType - generic response type
Returns:
typed object, can be null. Response status code and headers can be obtained too, see Client.getResponse()

put

public <T> Future<T> put(Object body,
                         javax.ws.rs.client.InvocationCallback<T> callback)
Does HTTP Async PUT invocation and returns Future. Shortcut for async().put(Entity, InvocationCallback)

Parameters:
callback - invocation callback
Returns:
the future

invokeAndGetCollection

public <T> Collection<? extends T> invokeAndGetCollection(String httpMethod,
                                                          Object body,
                                                          Class<T> memberClass)
Does HTTP invocation and returns a collection of typed objects

Parameters:
httpMethod - HTTP method
body - request body, can be null
memberClass - expected type of collection member class
Returns:
typed collection

postCollection

public <T> javax.ws.rs.core.Response postCollection(Object collection,
                                                    Class<T> memberClass)
Posts a collection of typed objects

Parameters:
collection - request body
memberClass - type of collection member class
Returns:
JAX-RS Response

postCollection

public <T1,T2> T2 postCollection(Object collection,
                                 Class<T1> memberClass,
                                 Class<T2> responseClass)
Posts a collection of typed objects

Parameters:
collection - request body
memberClass - type of collection member class
responseClass - expected type of response object
Returns:
JAX-RS Response

postAndGetCollection

public <T1,T2> Collection<? extends T2> postAndGetCollection(Object collection,
                                                             Class<T1> memberClass,
                                                             Class<T2> responseClass)
Posts collection of typed objects and returns a collection of typed objects

Parameters:
collection - request body
memberClass - type of collection member class
responseClass - expected type of response object
Returns:
JAX-RS Response

postObjectGetCollection

public <T> Collection<? extends T> postObjectGetCollection(Object body,
                                                           Class<T> responseClass)
Posts the object and returns a collection of typed objects

Parameters:
body - request body
memberClass - type of collection member class
responseClass - expected type of response object
Returns:
JAX-RS Response

postAndGetCollection

public <T> Collection<? extends T> postAndGetCollection(Object body,
                                                        Class<T> memberClass)
Posts request body and returns a collection of typed objects

Parameters:
body - request body, can be null
memberClass - expected type of collection member class
Returns:
typed collection

getCollection

public <T> Collection<? extends T> getCollection(Class<T> memberClass)
Does HTTP GET invocation and returns a collection of typed objects

Parameters:
body - request body, can be null
memberClass - expected type of collection member class
Returns:
typed collection

get

public <T> T get(Class<T> responseClass)
Does HTTP GET invocation and returns typed response object

Parameters:
body - request body, can be null
responseClass - expected type of response object
Returns:
typed object, can be null. Response status code and headers can be obtained too, see Client.getResponse()

get

public <T> T get(javax.ws.rs.core.GenericType<T> responseType)
Does HTTP GET invocation and returns typed response object

Parameters:
responseType - generic response type
Returns:
typed object, can be null. Response status code and headers can be obtained too, see Client.getResponse()

get

public <T> Future<T> get(javax.ws.rs.client.InvocationCallback<T> callback)
Does HTTP Async GET invocation and returns Future. Shortcut for async().get(InvocationCallback)

Parameters:
callback - invocation callback
Returns:
the future

path

public WebClient path(Object path)
Updates the current URI path

Parameters:
path - new relative path segment
Returns:
updated WebClient

path

public WebClient path(String path,
                      Object... values)
Updates the current URI path with path segment which may contain template variables

Parameters:
path - new relative path segment
values - template variable values
Returns:
updated WebClient

query

public WebClient query(String name,
                       Object... values)
Description copied from class: AbstractClient
Updates the current URI query parameters

Specified by:
query in interface Client
Overrides:
query in class AbstractClient
Parameters:
name - query name
values - query values
Returns:
updated WebClient

matrix

public WebClient matrix(String name,
                        Object... values)
Updates the current URI matrix parameters

Parameters:
name - matrix name
values - matrix values
Returns:
updated WebClient

fragment

public WebClient fragment(String name)
Updates the current URI fragment

Parameters:
name - fragment name
Returns:
updated WebClient

to

public WebClient to(String newAddress,
                    boolean forward)
Moves WebClient to a new baseURI or forwards to new currentURI

Parameters:
newAddress - new URI
forward - if true then currentURI will be based on baseURI
Returns:
updated WebClient

back

public WebClient back(boolean fast)
Goes back

Parameters:
fast - if true then goes back to baseURI otherwise to a previous path segment
Returns:
updated WebClient

replacePath

public WebClient replacePath(String path)
Replaces the current path with the new value.

Parameters:
path - new path value. If it starts from "/" then all the current path starting from the base URI will be replaced, otherwise only the last path segment will be replaced. Providing a null value is equivalent to calling back(true)
Returns:
updated WebClient

resetQuery

public WebClient resetQuery()
Resets the current query

Returns:
updated WebClient

replaceQuery

public WebClient replaceQuery(String queryString)
Replaces the current query with the new value.

Parameters:
queryString - the new value, providing a null is equivalent to calling resetQuery().
Returns:
updated WebClient

replaceHeader

public WebClient replaceHeader(String headerName,
                               String value)
Replaces the header value with the new values.

Parameters:
headerName - headerValues
value - new values, null is equivalent to removing the header
Returns:
updated WebClient

replaceQueryParam

public WebClient replaceQueryParam(String queryParam,
                                   Object... value)
Replaces the current query with the new value.

Parameters:
queryString - the new value, providing a null is equivalent to calling resetQuery().
Returns:
updated WebClient

type

public WebClient type(javax.ws.rs.core.MediaType ct)
Description copied from class: AbstractClient
sets HTTP Content-Type header

Specified by:
type in interface Client
Overrides:
type in class AbstractClient
Parameters:
ct - JAXRS MediaType representing Content-Type value
Returns:
the updated Client

type

public WebClient type(String type)
Description copied from class: AbstractClient
sets HTTP Content-Type header

Specified by:
type in interface Client
Overrides:
type in class AbstractClient
Parameters:
type - Content-Type value
Returns:
the updated Client

accept

public WebClient accept(javax.ws.rs.core.MediaType... types)
Description copied from class: AbstractClient
sets HTTP Accept header

Specified by:
accept in interface Client
Overrides:
accept in class AbstractClient
Parameters:
types - list of JAXRS MediaTypes representing Accept header values
Returns:
the updated Client

accept

public WebClient accept(String... types)
Description copied from class: AbstractClient
sets HTTP Accept header

Specified by:
accept in interface Client
Overrides:
accept in class AbstractClient
Parameters:
types - list of Accept header values
Returns:
the updated Client

language

public WebClient language(String language)
Description copied from class: AbstractClient
sets HTTP Content-Language header

Specified by:
language in interface Client
Overrides:
language in class AbstractClient
Parameters:
language - Content-Language header value
Returns:
the updated Client

acceptLanguage

public WebClient acceptLanguage(String... languages)
Description copied from class: AbstractClient
sets HTTP Accept-Language header

Specified by:
acceptLanguage in interface Client
Overrides:
acceptLanguage in class AbstractClient
Parameters:
languages - list of Accept-Language header values
Returns:
the updated Client

encoding

public WebClient encoding(String encoding)
Description copied from class: AbstractClient
sets HTTP Content-Encoding header

Specified by:
encoding in interface Client
Overrides:
encoding in class AbstractClient
Parameters:
encoding - Content-Encoding header value
Returns:
the updated Client

acceptEncoding

public WebClient acceptEncoding(String... encodings)
Description copied from class: AbstractClient
sets HTTP Accept-Encoding header

Specified by:
acceptEncoding in interface Client
Overrides:
acceptEncoding in class AbstractClient
Parameters:
encodings - list of Accept-Encoding header value
Returns:
the updated Client

match

public WebClient match(javax.ws.rs.core.EntityTag tag,
                       boolean ifNot)
Description copied from class: AbstractClient
sets HTTP If-Match or If-None-Match header

Specified by:
match in interface Client
Overrides:
match in class AbstractClient
Parameters:
tag - ETag value
ifNot - if true then If-None-Match is set, If-Match otherwise
Returns:
the updated Client

modified

public WebClient modified(Date date,
                          boolean ifNot)
Description copied from class: AbstractClient
sets HTTP If-Modified-Since or If-Unmodified-Since header

Specified by:
modified in interface Client
Overrides:
modified in class AbstractClient
Parameters:
date - Date value, will be formated as "EEE, dd MMM yyyy HH:mm:ss zzz"
ifNot - if true then If-Unmodified-Since is set, If-Modified-Since otherwise
Returns:
the updated Client

cookie

public WebClient cookie(javax.ws.rs.core.Cookie cookie)
Description copied from class: AbstractClient
sets HTTP Cookie header

Specified by:
cookie in interface Client
Overrides:
cookie in class AbstractClient
Parameters:
cookie - Cookie value
Returns:
the updated Client

header

public WebClient header(String name,
                        Object... values)
Description copied from class: AbstractClient
Sets arbitrary HTTP Header

Specified by:
header in interface Client
Overrides:
header in class AbstractClient
Parameters:
name - header name
values - list of header values
Returns:
the updated Client

headers

public WebClient headers(javax.ws.rs.core.MultivaluedMap<String,String> map)
Description copied from class: AbstractClient
Sets HTTP Headers

Specified by:
headers in interface Client
Overrides:
headers in class AbstractClient
Parameters:
map - headers
Returns:
the updated Client

reset

public WebClient reset()
Description copied from class: AbstractClient
Resets the headers and response state if any

Specified by:
reset in interface Client
Overrides:
reset in class AbstractClient
Returns:
the updated Client

doInvoke

protected javax.ws.rs.core.Response doInvoke(String httpMethod,
                                             Object body,
                                             Type inGenericType,
                                             Class<?> responseClass,
                                             Type outGenericType)

doInvoke

protected javax.ws.rs.core.Response doInvoke(String httpMethod,
                                             Object body,
                                             Class<?> requestClass,
                                             Type inGenericType,
                                             Class<?> responseClass,
                                             Type outGenericType)

doInvokeAsyncCallback

protected <T> Future<T> doInvokeAsyncCallback(String httpMethod,
                                              Object body,
                                              Class<?> requestClass,
                                              Type inType,
                                              javax.ws.rs.client.InvocationCallback<T> callback)

doInvokeAsync

protected <T> Future<T> doInvokeAsync(String httpMethod,
                                      Object body,
                                      Class<?> requestClass,
                                      Type inType,
                                      Class<?> respClass,
                                      Type outType,
                                      javax.ws.rs.client.InvocationCallback<T> callback)

retryInvoke

protected Object retryInvoke(URI newRequestURI,
                             javax.ws.rs.core.MultivaluedMap<String,String> headers,
                             Object body,
                             Exchange exchange,
                             Map<String,Object> invContext)
                      throws Throwable
Specified by:
retryInvoke in class AbstractClient
Throws:
Throwable

doChainedInvocation

protected javax.ws.rs.core.Response doChainedInvocation(String httpMethod,
                                                        javax.ws.rs.core.MultivaluedMap<String,String> headers,
                                                        Object body,
                                                        Class<?> requestClass,
                                                        Type inType,
                                                        Annotation[] inAnns,
                                                        Class<?> respClass,
                                                        Type outType,
                                                        Exchange exchange,
                                                        Map<String,Object> invContext)

doResponse

protected javax.ws.rs.core.Response doResponse(Message m,
                                               Class<?> responseClass,
                                               Type outGenericType)

handleResponse

protected javax.ws.rs.core.Response handleResponse(Message outMessage,
                                                   Class<?> responseClass,
                                                   Type genericType)

async

public javax.ws.rs.client.AsyncInvoker async()

sync

public javax.ws.rs.client.SyncInvoker sync()

Apache CXF API

Apache CXF