public class ClientInvocationBuilder extends Object implements Invocation.Builder
Modifier and Type | Field and Description |
---|---|
protected ClientInvocation |
invocation |
Constructor and Description |
---|
ClientInvocationBuilder(ResteasyClient client,
URI uri,
ClientConfiguration configuration) |
Modifier and Type | Method and Description |
---|---|
Invocation.Builder |
accept(MediaType... mediaTypes)
Add the accepted response media types.
|
Invocation.Builder |
accept(String... mediaTypes)
Add the accepted response media types.
|
Invocation.Builder |
acceptEncoding(String... encodings)
Add acceptable encodings.
|
Invocation.Builder |
acceptLanguage(Locale... locales)
Add acceptable languages.
|
Invocation.Builder |
acceptLanguage(String... locales)
Add acceptable languages.
|
AsyncInvoker |
async()
Access the asynchronous uniform request invocation interface to
asynchronously invoke the built request.
|
Invocation |
build(String method)
Build a request invocation using an arbitrary request method name.
|
Invocation |
build(String method,
Entity<?> entity)
Build a request invocation using an arbitrary request method name and
request entity.
|
Invocation |
buildDelete()
Build a DELETE request invocation.
|
Invocation |
buildGet()
Build a GET request invocation.
|
Invocation |
buildPost(Entity<?> entity)
Build a POST request invocation.
|
Invocation |
buildPut(Entity<?> entity)
Build a PUT request invocation.
|
Invocation.Builder |
cacheControl(CacheControl cacheControl)
Set the cache control data of the message.
|
Invocation.Builder |
cookie(Cookie cookie)
Add a cookie to be set.
|
Invocation.Builder |
cookie(String name,
String value)
Add a cookie to be set.
|
Response |
delete()
Invoke HTTP DELETE method for the current request synchronously.
|
<T> T |
delete(Class<T> responseType)
Invoke HTTP DELETE method for the current request synchronously.
|
<T> T |
delete(GenericType<T> responseType)
Invoke HTTP DELETE method for the current request synchronously.
|
Response |
get()
Invoke HTTP GET method for the current request synchronously.
|
<T> T |
get(Class<T> responseType)
Invoke HTTP GET method for the current request synchronously.
|
<T> T |
get(GenericType<T> responseType)
Invoke HTTP GET method for the current request synchronously.
|
ClientRequestHeaders |
getHeaders() |
ClientInvocation |
getInvocation() |
Response |
head()
Invoke HTTP HEAD method for the current request synchronously.
|
Invocation.Builder |
header(String name,
Object value)
Add an arbitrary header.
|
Invocation.Builder |
headers(MultivaluedMap<String,Object> headers)
Replaces all existing headers with the newly supplied headers.
|
boolean |
isChunked() |
Response |
method(String name)
Invoke an arbitrary method for the current request synchronously.
|
<T> T |
method(String name,
Class<T> responseType)
Invoke an arbitrary method for the current request synchronously.
|
Response |
method(String name,
Entity<?> entity)
Invoke an arbitrary method for the current request synchronously.
|
<T> T |
method(String name,
Entity<?> entity,
Class<T> responseType)
Invoke an arbitrary method for the current request synchronously.
|
<T> T |
method(String name,
Entity<?> entity,
GenericType<T> responseType)
Invoke an arbitrary method for the current request synchronously.
|
<T> T |
method(String name,
GenericType<T> responseType)
Invoke an arbitrary method for the current request synchronously.
|
Response |
options()
Invoke HTTP OPTIONS method for the current request synchronously.
|
<T> T |
options(Class<T> responseType)
Invoke HTTP OPTIONS method for the current request synchronously.
|
<T> T |
options(GenericType<T> responseType)
Invoke HTTP OPTIONS method for the current request synchronously.
|
Response |
post(Entity<?> entity)
Invoke HTTP POST method for the current request synchronously.
|
<T> T |
post(Entity<?> entity,
Class<T> responseType)
Invoke HTTP POST method for the current request synchronously.
|
<T> T |
post(Entity<?> entity,
GenericType<T> responseType)
Invoke HTTP POST method for the current request synchronously.
|
Invocation.Builder |
property(String name,
Object value)
Set a new property in the context of a request represented by this invocation builder.
|
Response |
put(Entity<?> entity)
Invoke HTTP PUT method for the current request synchronously.
|
<T> T |
put(Entity<?> entity,
Class<T> responseType)
Invoke HTTP PUT method for the current request synchronously.
|
<T> T |
put(Entity<?> entity,
GenericType<T> responseType)
Invoke HTTP PUT method for the current request synchronously.
|
void |
setChunked(boolean chunked) |
Response |
trace()
Invoke HTTP TRACE method for the current request synchronously.
|
<T> T |
trace(Class<T> responseType)
Invoke HTTP TRACE method for the current request synchronously.
|
<T> T |
trace(GenericType<T> responseType)
Invoke HTTP TRACE method for the current request synchronously.
|
protected ClientInvocation invocation
public ClientInvocationBuilder(ResteasyClient client, URI uri, ClientConfiguration configuration)
public ClientInvocation getInvocation()
public ClientRequestHeaders getHeaders()
public Invocation.Builder accept(String... mediaTypes)
Invocation.Builder
accept
in interface Invocation.Builder
mediaTypes
- accepted response media types.public Invocation.Builder accept(MediaType... mediaTypes)
Invocation.Builder
accept
in interface Invocation.Builder
mediaTypes
- accepted response media types.public Invocation.Builder acceptLanguage(Locale... locales)
Invocation.Builder
acceptLanguage
in interface Invocation.Builder
locales
- an array of the acceptable languages.public Invocation.Builder acceptLanguage(String... locales)
Invocation.Builder
acceptLanguage
in interface Invocation.Builder
locales
- an array of the acceptable languages.public Invocation.Builder acceptEncoding(String... encodings)
Invocation.Builder
acceptEncoding
in interface Invocation.Builder
encodings
- an array of the acceptable encodings.public Invocation.Builder cookie(Cookie cookie)
Invocation.Builder
cookie
in interface Invocation.Builder
cookie
- to be set.public Invocation.Builder cookie(String name, String value)
Invocation.Builder
cookie
in interface Invocation.Builder
name
- the name of the cookie.value
- the value of the cookie.public Invocation.Builder cacheControl(CacheControl cacheControl)
Invocation.Builder
cacheControl
in interface Invocation.Builder
cacheControl
- the cache control directives, if null
any existing cache control directives will be removed.public Invocation.Builder header(String name, Object value)
Invocation.Builder
header
in interface Invocation.Builder
name
- the name of the headervalue
- the value of the header, the header will be serialized
using a RuntimeDelegate.HeaderDelegate
if
one is available via RuntimeDelegate.createHeaderDelegate(java.lang.Class)
for the class of value
or using its toString
method
if a header delegate is not available. If value
is null
then all current headers of the same name will be removed.public Invocation.Builder headers(MultivaluedMap<String,Object> headers)
Invocation.Builder
headers
in interface Invocation.Builder
headers
- new headers to be set, if null
all existing
headers will be removed.public Invocation build(String method)
Invocation.Builder
build
in interface Invocation.Builder
method
- request method name.public Invocation build(String method, Entity<?> entity)
Invocation.Builder
build
in interface Invocation.Builder
method
- request method name.entity
- request entity, including it's full Variant
information.
Any variant-related HTTP headers previously set (namely Content-Type
,
Content-Language
and Content-Encoding
) will be overwritten using
the entity variant information.public Invocation buildGet()
Invocation.Builder
buildGet
in interface Invocation.Builder
public Invocation buildDelete()
Invocation.Builder
buildDelete
in interface Invocation.Builder
public Invocation buildPost(Entity<?> entity)
Invocation.Builder
buildPost
in interface Invocation.Builder
entity
- request entity, including it's full Variant
information.
Any variant-related HTTP headers previously set (namely Content-Type
,
Content-Language
and Content-Encoding
) will be overwritten using
the entity variant information.public Invocation buildPut(Entity<?> entity)
Invocation.Builder
buildPut
in interface Invocation.Builder
entity
- request entity, including it's full Variant
information.
Any variant-related HTTP headers previously set (namely Content-Type
,
Content-Language
and Content-Encoding
) will be overwritten using
the entity variant information.public AsyncInvoker async()
Invocation.Builder
async
in interface Invocation.Builder
public Response get()
SyncInvoker
get
in interface SyncInvoker
public <T> T get(Class<T> responseType)
SyncInvoker
get
in interface SyncInvoker
T
- response entity type.responseType
- Java type the response entity will be converted to.public <T> T get(GenericType<T> responseType)
SyncInvoker
get
in interface SyncInvoker
T
- generic response entity type.responseType
- representation of a generic Java type the response
entity will be converted to.public Response put(Entity<?> entity)
SyncInvoker
put
in interface SyncInvoker
entity
- request entity, including it's full Variant
information.
Any variant-related HTTP headers previously set (namely Content-Type
,
Content-Language
and Content-Encoding
) will be overwritten using
the entity variant information.public <T> T put(Entity<?> entity, Class<T> responseType)
SyncInvoker
put
in interface SyncInvoker
T
- response entity type.entity
- request entity, including it's full Variant
information.
Any variant-related HTTP headers previously set (namely Content-Type
,
Content-Language
and Content-Encoding
) will be overwritten using
the entity variant information.responseType
- Java type the response entity will be converted to.public <T> T put(Entity<?> entity, GenericType<T> responseType)
SyncInvoker
put
in interface SyncInvoker
T
- generic response entity type.entity
- request entity, including it's full Variant
information.
Any variant-related HTTP headers previously set (namely Content-Type
,
Content-Language
and Content-Encoding
) will be overwritten using
the entity variant information.responseType
- representation of a generic Java type the response
entity will be converted to.public Response post(Entity<?> entity)
SyncInvoker
post
in interface SyncInvoker
entity
- request entity, including it's full Variant
information.
Any variant-related HTTP headers previously set (namely Content-Type
,
Content-Language
and Content-Encoding
) will be overwritten using
the entity variant information.public <T> T post(Entity<?> entity, Class<T> responseType)
SyncInvoker
post
in interface SyncInvoker
T
- response entity type.entity
- request entity, including it's full Variant
information.
Any variant-related HTTP headers previously set (namely Content-Type
,
Content-Language
and Content-Encoding
) will be overwritten using
the entity variant information.responseType
- Java type the response entity will be converted to.public <T> T post(Entity<?> entity, GenericType<T> responseType)
SyncInvoker
post
in interface SyncInvoker
T
- generic response entity type.entity
- request entity, including it's full Variant
information.
Any variant-related HTTP headers previously set (namely Content-Type
,
Content-Language
and Content-Encoding
) will be overwritten using
the entity variant information.responseType
- representation of a generic Java type the response
entity will be converted to.public Response delete()
SyncInvoker
delete
in interface SyncInvoker
public <T> T delete(Class<T> responseType)
SyncInvoker
delete
in interface SyncInvoker
T
- response entity type.responseType
- Java type the response entity will be converted to.public <T> T delete(GenericType<T> responseType)
SyncInvoker
delete
in interface SyncInvoker
T
- generic response entity type.responseType
- representation of a generic Java type the response
entity will be converted to.public Response head()
SyncInvoker
head
in interface SyncInvoker
public Response options()
SyncInvoker
options
in interface SyncInvoker
public <T> T options(Class<T> responseType)
SyncInvoker
options
in interface SyncInvoker
T
- response entity type.responseType
- Java type the response entity will be converted to.public <T> T options(GenericType<T> responseType)
SyncInvoker
options
in interface SyncInvoker
T
- generic response entity type.responseType
- representation of a generic Java type the response
entity will be converted to.public Response trace()
SyncInvoker
trace
in interface SyncInvoker
public <T> T trace(Class<T> responseType)
SyncInvoker
trace
in interface SyncInvoker
T
- response entity type.responseType
- Java type the response entity will be converted to.public <T> T trace(GenericType<T> responseType)
SyncInvoker
trace
in interface SyncInvoker
T
- generic response entity type.responseType
- representation of a generic Java type the response
entity will be converted to.public Response method(String name)
SyncInvoker
method
in interface SyncInvoker
name
- method name.public <T> T method(String name, Class<T> responseType)
SyncInvoker
method
in interface SyncInvoker
T
- response entity type.name
- method name.responseType
- Java type the response entity will be converted to.public <T> T method(String name, GenericType<T> responseType)
SyncInvoker
method
in interface SyncInvoker
T
- generic response entity type.name
- method name.responseType
- representation of a generic Java type the response
entity will be converted to.public Response method(String name, Entity<?> entity)
SyncInvoker
method
in interface SyncInvoker
name
- method name.entity
- request entity, including it's full Variant
information.
Any variant-related HTTP headers previously set (namely Content-Type
,
Content-Language
and Content-Encoding
) will be overwritten using
the entity variant information.public <T> T method(String name, Entity<?> entity, Class<T> responseType)
SyncInvoker
method
in interface SyncInvoker
T
- response entity type.name
- method name.entity
- request entity, including it's full Variant
information.
Any variant-related HTTP headers previously set (namely Content-Type
,
Content-Language
and Content-Encoding
) will be overwritten using
the entity variant information.responseType
- Java type the response entity will be converted to.public <T> T method(String name, Entity<?> entity, GenericType<T> responseType)
SyncInvoker
method
in interface SyncInvoker
T
- generic response entity type.name
- method name.entity
- request entity, including it's full Variant
information.
Any variant-related HTTP headers previously set (namely Content-Type
,
Content-Language
and Content-Encoding
) will be overwritten using
the entity variant information.responseType
- representation of a generic Java type the response
entity will be converted to.public Invocation.Builder property(String name, Object value)
Invocation.Builder
The property is available for a later retrieval via ClientRequestContext.getProperty(String)
or InterceptorContext.getProperty(String)
.
If a property with a given name is already set in the request context,
the existing value of the property will be updated.
Setting a null
value into a property effectively removes the property
from the request property bag.
property
in interface Invocation.Builder
name
- property name.value
- (new) property value. null
value removes the property
with the given name.Invocation.property(String, Object)
public boolean isChunked()
public void setChunked(boolean chunked)
Copyright © 2017 JBoss by Red Hat. All rights reserved.