public class RestClient extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
RestClient.RestInvocationCallback<T> |
| Constructor and Description |
|---|
RestClient(String basePath) |
RestClient(javax.ws.rs.client.WebTarget webTarget)
Constructs an orbit rest client from a jax-rs WebTarget.
|
RestClient(javax.ws.rs.client.WebTarget target,
javax.ws.rs.core.MultivaluedHashMap<String,Object> headers) |
| Modifier and Type | Method and Description |
|---|---|
<T extends RestClient> |
addHeader(String key,
String value)
Returns a new OrbitRestClient with where with an extra header
|
protected CompletableFuture<Object> |
createFuture(Method method) |
<T> T |
get(Class<T> interfaceClass)
Returns an implementation of a jax-rs interface.
|
javax.ws.rs.core.MultivaluedMap<String,Object> |
getHeaders()
Returns a copy of the headers.
|
protected Object |
handleInvokeException(Throwable e) |
protected <T extends RestClient> |
newClient(javax.ws.rs.client.WebTarget target,
javax.ws.rs.core.MultivaluedHashMap<String,Object> headers) |
<T extends RestClient> |
property(String propertyName,
Object propertyValue)
Builds a new Rest Client with a WebTarget that applies the specified property.
|
protected static <TThrowable extends Throwable,TResult> |
reThrow(Throwable throwable)
Allows Rest Clients to filter exceptions that may arises from invoked calls.
|
<T extends RestClient> |
setHeader(String key,
String value)
Returns a new OrbitRestClient with the header
key replaced/set |
<T extends RestClient> |
setHeaders(javax.ws.rs.core.MultivaluedMap<String,Object> headers)
Returns a new orbit rest client replacing all the headers
|
public RestClient(String basePath)
public RestClient(javax.ws.rs.client.WebTarget webTarget)
webTarget - a jax-rx target, can be obtained with a jax-rs implementation,
for instance org.glassfish.jersey.core:jersey-clien.public javax.ws.rs.core.MultivaluedMap<String,Object> getHeaders()
public <T extends RestClient> T setHeaders(javax.ws.rs.core.MultivaluedMap<String,Object> headers)
public <T extends RestClient> T setHeader(String key, String value)
key replaced/setpublic <T extends RestClient> T addHeader(String key, String value)
protected <T extends RestClient> T newClient(javax.ws.rs.client.WebTarget target, javax.ws.rs.core.MultivaluedHashMap<String,Object> headers)
public <T> T get(Class<T> interfaceClass)
CompletableFuture or cloud.orbit.concurrent.Task
If that is the case, those methods will return immediately and the Future will be completed asynchronously.T - The interface typeinterfaceClass - the jax-rs annotated interface classprotected static <TThrowable extends Throwable,TResult> TResult reThrow(Throwable throwable) throws TThrowable extends Throwable
TThrowable - The Throwable type that will be returnedTResult - The actual type returnedthrowable - The exception that was encounteredTThrowableTThrowable extends Throwableprotected CompletableFuture<Object> createFuture(Method method)
public <T extends RestClient> T property(String propertyName, Object propertyValue)
T - Rest ClientpropertyName - Property to set a value onpropertyValue - Value to applyCopyright © 2016 Electronic Arts Inc. All rights reserved.