public interface UniformInterface
Any Java type for a response entity, that is supported by the client
configuration of the client, may be declared using
Class<T>
where T
is the Java type, or
using GenericType
where the generic parameter is the Java type.
Any Java type instance for a request entity, that is supported by the client
configuration of the client, can be passed. If generic information is
required then an instance of GenericEntity
may
be used.
A type of ClientResponse
declared
for the response entity may be used to obtain the status, headers and
response entity.
If any type, other than ClientResponse
,
is declared and the response status is greater than or equal to 300 then a
UniformInterfaceException
exception
will be thrown, from which the
ClientResponse
instance can be
accessed.
In the following cases it is necessary to close the response, when response processing has completed, to ensure that underlying resources are correctly released.
If a response entity is declared of the type
ClientResponse
or of a type that is assignable to Closeable
(such as InputStream
) then the response must be either:
1) closed by invoking the method
ClientResponse.close()
or
Closeable.close()
; or 2) all bytes of response entity must be
read.
If a UniformInterfaceException
is
thrown then by default the response entity is automatically buffered and
the underlying resources are correctly released. See the following property
for more details:
ClientConfig.PROPERTY_BUFFER_RESPONSE_ENTITY_ON_EXCEPTION
.
com.sun.jersey.api.client
Modifier and Type | Method and Description |
---|---|
void |
delete()
Invoke the DELETE method with no request entity or response.
|
<T> T |
delete(java.lang.Class<T> c)
Invoke the DELETE method with no request entity that returns a response.
|
<T> T |
delete(java.lang.Class<T> c,
java.lang.Object requestEntity)
Invoke the DELETE method with a request entity that returns a response.
|
<T> T |
delete(GenericType<T> gt)
Invoke the DELETE method with a request entity that returns a response.
|
<T> T |
delete(GenericType<T> gt,
java.lang.Object requestEntity)
Invoke the DELETE method with a request entity that returns a response.
|
void |
delete(java.lang.Object requestEntity)
Invoke the DELETE method with a request entity but no response.
|
<T> T |
get(java.lang.Class<T> c)
Invoke the GET method.
|
<T> T |
get(GenericType<T> gt)
Invoke the GET method.
|
ClientResponse |
head()
Invoke the HEAD method.
|
void |
method(java.lang.String method)
Invoke a HTTP method with no request entity or response.
|
<T> T |
method(java.lang.String method,
java.lang.Class<T> c)
Invoke a HTTP method with no request entity that returns a response.
|
<T> T |
method(java.lang.String method,
java.lang.Class<T> c,
java.lang.Object requestEntity)
Invoke a HTTP method with a request entity that returns a response.
|
<T> T |
method(java.lang.String method,
GenericType<T> gt)
Invoke a HTTP method with no request entity that returns a response.
|
<T> T |
method(java.lang.String method,
GenericType<T> gt,
java.lang.Object requestEntity)
Invoke a HTTP method with a request entity that returns a response.
|
void |
method(java.lang.String method,
java.lang.Object requestEntity)
Invoke a HTTP method with a request entity but no response.
|
<T> T |
options(java.lang.Class<T> c)
Invoke the OPTIONS method.
|
<T> T |
options(GenericType<T> gt)
Invoke the OPTIONS method.
|
void |
post()
Invoke the POST method with no request entity or response.
|
<T> T |
post(java.lang.Class<T> c)
Invoke the POST method with no request entity that returns a response.
|
<T> T |
post(java.lang.Class<T> c,
java.lang.Object requestEntity)
Invoke the POST method with a request entity that returns a response.
|
<T> T |
post(GenericType<T> gt)
Invoke the POST method with a request entity that returns a response.
|
<T> T |
post(GenericType<T> gt,
java.lang.Object requestEntity)
Invoke the POST method with a request entity that returns a response.
|
void |
post(java.lang.Object requestEntity)
Invoke the POST method with a request entity but no response.
|
void |
put()
Invoke the PUT method with no request entity or response.
|
<T> T |
put(java.lang.Class<T> c)
Invoke the PUT method with no request entity that returns a response.
|
<T> T |
put(java.lang.Class<T> c,
java.lang.Object requestEntity)
Invoke the PUT method with a request entity that returns a response.
|
<T> T |
put(GenericType<T> gt)
Invoke the PUT method with a request entity that returns a response.
|
<T> T |
put(GenericType<T> gt,
java.lang.Object requestEntity)
Invoke the PUT method with a request entity that returns a response.
|
void |
put(java.lang.Object requestEntity)
Invoke the PUT method with a request entity but no response.
|
ClientResponse head() throws ClientHandlerException
ClientHandlerException
- if the client handler fails to process
the request or response.<T> T options(java.lang.Class<T> c) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.c
- the type of the returned response.c
.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and c
is not the type
ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T options(GenericType<T> gt) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.gt
- the generic type of the returned response.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and gt
does not
represent the type ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T get(java.lang.Class<T> c) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.c
- the type of the returned response.c
.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and c
is not the type
ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T get(GenericType<T> gt) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.gt
- the generic type of the returned response.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and gt
does not
represent the type ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.void put() throws UniformInterfaceException, ClientHandlerException
If the status code is less than 300 and a representation is present then that representation is ignored.
UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300.ClientHandlerException
- if the client handler fails to process
the request or response.void put(java.lang.Object requestEntity) throws UniformInterfaceException, ClientHandlerException
If the status code is less than 300 and a representation is present then that representation is ignored.
requestEntity
- the request entity.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T put(java.lang.Class<T> c) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.c
- the type of the returned response.c
.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and c
is not the type
ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T put(GenericType<T> gt) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.gt
- the generic type of the returned response.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and gt
does not
represent the type ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T put(java.lang.Class<T> c, java.lang.Object requestEntity) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.c
- the type of the returned response.requestEntity
- the request entity.c
.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and c
is not the type
ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T put(GenericType<T> gt, java.lang.Object requestEntity) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.gt
- the generic type of the returned response.requestEntity
- the request entity.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and gt
does not
represent the type ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.void post() throws UniformInterfaceException, ClientHandlerException
If the status code is less than 300 and a representation is present then that representation is ignored.
UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300.ClientHandlerException
- if the client handler fails to process
the request or response.void post(java.lang.Object requestEntity) throws UniformInterfaceException, ClientHandlerException
If the status code is less than 300 and a representation is present then that representation is ignored.
requestEntity
- the request entity.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T post(java.lang.Class<T> c) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.c
- the type of the returned response.c
.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and c
is not the type
ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T post(GenericType<T> gt) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.gt
- the generic type of the returned response.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and gt
does not
represent the type ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T post(java.lang.Class<T> c, java.lang.Object requestEntity) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.c
- the type of the returned response.requestEntity
- the request entity.c
.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and c
is not the type
ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T post(GenericType<T> gt, java.lang.Object requestEntity) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.gt
- the generic type of the returned response.requestEntity
- the request entity.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and gt
does not
represent the type ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.void delete() throws UniformInterfaceException, ClientHandlerException
If the status code is less than 300 and a representation is present then that representation is ignored.
UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300.ClientHandlerException
- if the client handler fails to process
the request or response.void delete(java.lang.Object requestEntity) throws UniformInterfaceException, ClientHandlerException
If the status code is less than 300 and a representation is present then that representation is ignored.
requestEntity
- the request entity.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T delete(java.lang.Class<T> c) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.c
- the type of the returned response.c
.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and c
is not the type
ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T delete(GenericType<T> gt) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.gt
- the generic type of the returned response.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and gt
does not
represent the type ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T delete(java.lang.Class<T> c, java.lang.Object requestEntity) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.c
- the type of the returned response.requestEntity
- the request entity.c
.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and c
is not the type
ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T delete(GenericType<T> gt, java.lang.Object requestEntity) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.gt
- the generic type of the returned response.requestEntity
- the request entity.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and gt
does not
represent the type ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.void method(java.lang.String method) throws UniformInterfaceException, ClientHandlerException
If the status code is less than 300 and a representation is present then that representation is ignored.
method
- the HTTP method.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300.ClientHandlerException
- if the client handler fails to process
the request or response.void method(java.lang.String method, java.lang.Object requestEntity) throws UniformInterfaceException, ClientHandlerException
If the status code is less than 300 and a representation is present then that representation is ignored.
method
- the HTTP method.requestEntity
- the request entity.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T method(java.lang.String method, java.lang.Class<T> c) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.method
- the HTTP method.c
- the type of the returned response.c
.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and c
is not the type
ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T method(java.lang.String method, GenericType<T> gt) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.method
- the HTTP method.gt
- the generic type of the returned response.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and gt
does not
represent the type ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T method(java.lang.String method, java.lang.Class<T> c, java.lang.Object requestEntity) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.method
- the HTTP method.c
- the type of the returned response.requestEntity
- the request entity.c
.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and c
is not the type
ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.<T> T method(java.lang.String method, GenericType<T> gt, java.lang.Object requestEntity) throws UniformInterfaceException, ClientHandlerException
T
- the type of the response.method
- the HTTP method.gt
- the generic type of the returned response.requestEntity
- the request entity.UniformInterfaceException
- if the status of the HTTP response is
greater than or equal to 300 and gt
does not
represent the type ClientResponse
.ClientHandlerException
- if the client handler fails to process
the request or response.Copyright © 2016 Oracle Corporation. All Rights Reserved.