Package com.oracle.bmc.http.internal
Class RestClient
- java.lang.Object
-
- com.oracle.bmc.http.internal.RestClient
-
- All Implemented Interfaces:
AutoCloseable
public class RestClient extends Object implements AutoCloseable
A REST client that can make synchronous and asynchronous calls.
For asynchronous call, please refer to https://dennis-xlc.gitbooks.io/restful-java-with-jax-rs-2-0-2rd-edition/en/part1/chapter13/async_invoker_client_api.html to understand why we’d better not mix to using callback or Java Future.
-
-
Constructor Summary
Constructors Constructor Description RestClient(javax.ws.rs.client.Client client, EntityFactory entityFactory, JaxRsCircuitBreaker circuitBreaker)Create a new client that uses a provided client to make all its requests.RestClient(javax.ws.rs.client.Client client, EntityFactory entityFactory, JaxRsCircuitBreaker circuitBreaker, boolean isApacheNonBufferingClient)Create a new client that uses a provided client to make all its requests.RestClient(javax.ws.rs.client.Client client, EntityFactory entityFactory, JaxRsCircuitBreaker circuitBreaker, boolean isApacheNonBufferingClient, ClientConfigurator clientConfigurator)Create a new client that uses a provided client to make all its requests.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()<T extends BmcRequest>
javax.ws.rs.core.Responsedelete(WrappedInvocationBuilder ib, T request)Execute a delete on a resource and get the response.<T extends BmcRequest>
Future<javax.ws.rs.core.Response>delete(WrappedInvocationBuilder ib, T request, Consumer<javax.ws.rs.core.Response> onSuccess, Consumer<Throwable> onError)Execute a delete on a resource asynchronously and get the response.<B,REQUEST extends BmcRequest<B>,RESPONSE>
Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>>deleteFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)Deprecated.use the method without Guava parameters instead<B,REQUEST extends BmcRequest<B>,RESPONSE>
Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>>deleteFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)Return the function that, given anAsyncHandler, makes the delete request and returns the future.static StringgenerateRequestId()<T extends BmcRequest>
javax.ws.rs.core.Responseget(WrappedInvocationBuilder ib, T request)Request a resource.<T extends BmcRequest>
Future<javax.ws.rs.core.Response>get(WrappedInvocationBuilder ib, T request, Consumer<javax.ws.rs.core.Response> onSuccess, Consumer<Throwable> onError)Request a resource asynchronously.WrappedWebTargetgetBaseTarget()Gets the target (endpoint) for this client.JaxRsCircuitBreakergetCircuitBreaker()Gets the underlying circuitBreaker implementation for this clientjavax.ws.rs.client.ClientgetClient()ClientConfiguratorgetClientConfigurator()The client configurator used for configuring the client.StringgetEndpoint()Gets the endpoint that this client should talk to.<B,REQUEST extends BmcRequest<B>,RESPONSE>
Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>>getFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)Deprecated.Use the method without Guava parameters instead<B,REQUEST extends BmcRequest<B>,RESPONSE>
Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>>getFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)Return the function that, given anAsyncHandler, makes the get request and returns the future.Map<String,Boolean>getOptionsMap()StringgetRequestUri()Gets the requestURI for this client.<T extends BmcRequest>
javax.ws.rs.core.Responsehead(WrappedInvocationBuilder ib, T request)Execute a head request for a resource and return the response.<T extends BmcRequest>
Future<javax.ws.rs.core.Response>head(WrappedInvocationBuilder ib, T request, Consumer<javax.ws.rs.core.Response> onSuccess, Consumer<Throwable> onError)Execute a head request for a resource asynchronously and return the response.<B,REQUEST extends BmcRequest<B>,RESPONSE>
Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>>headFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)Deprecated.use method without Guava parameters instead<B,REQUEST extends BmcRequest<B>,RESPONSE>
Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>>headFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)Return the function that, given anAsyncHandler, makes the head request and returns the future.<T extends BmcRequest>
javax.ws.rs.core.Responsepatch(WrappedInvocationBuilder ib, Object body, T request)Patch a request object to the endpoint represented by the web target and get the response.<T extends BmcRequest>
Future<javax.ws.rs.core.Response>patch(WrappedInvocationBuilder ib, Object body, T request, Consumer<javax.ws.rs.core.Response> onSuccess, Consumer<Throwable> onError)Patch a request object to the endpoint represented by the web target asynchronously and get the response.<T extends BmcRequest>
javax.ws.rs.core.Responsepatch(WrappedInvocationBuilder ib, T request)Patch a request object without body to the endpoint represented by the web target and get the response.<T extends BmcRequest>
Future<javax.ws.rs.core.Response>patch(WrappedInvocationBuilder ib, T request, Consumer<javax.ws.rs.core.Response> onSuccess, Consumer<Throwable> onError)Patch a request object without body to the endpoint represented by the web target asynchronously and get the response.<B,REQUEST extends BmcRequest<B>,RESPONSE>
Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>>patchFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)Deprecated.use method without Guava parameters instead<B,REQUEST extends BmcRequest<B>,RESPONSE>
Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>>patchFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)Return the function that, given anAsyncHandler, makes the patch request and returns the future<B,REQUEST extends BmcRequest<B>,RESPONSE>
Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>>patchFutureSupplier(REQUEST interceptedRequest, Object body, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)Deprecated.use method without Guava parameters instead<B,REQUEST extends BmcRequest<B>,RESPONSE>
Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>>patchFutureSupplier(REQUEST interceptedRequest, Object body, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)Return the function that, given anAsyncHandler, makes the patch request and returns the future<T extends BmcRequest>
javax.ws.rs.core.Responsepost(WrappedInvocationBuilder ib, Object body, T request)Post a request object to the endpoint represented by the web target and get the response.<T extends BmcRequest>
Future<javax.ws.rs.core.Response>post(WrappedInvocationBuilder ib, Object body, T request, Consumer<javax.ws.rs.core.Response> onSuccess, Consumer<Throwable> onError)Post a request object to the endpoint represented by the web target asynchronously and get the response.<T extends BmcRequest>
javax.ws.rs.core.Responsepost(WrappedInvocationBuilder ib, T request)Post an empty body to the endpoint represented by the web target and get the response.<T extends BmcRequest>
Future<javax.ws.rs.core.Response>post(WrappedInvocationBuilder ib, T request, Consumer<javax.ws.rs.core.Response> onSuccess, Consumer<Throwable> onError)Post an empty body to the endpoint represented by the web target asynchronously and get the response.<B,REQUEST extends BmcRequest<B>,RESPONSE>
Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>>postFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)Deprecated.use method without GUava parameters instead<B,REQUEST extends BmcRequest<B>,RESPONSE>
Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>>postFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)Return the function that, given anAsyncHandler, makes the post request and returns the future<B,REQUEST extends BmcRequest<B>,RESPONSE>
Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>>postFutureSupplier(REQUEST interceptedRequest, Object body, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)Deprecated.use the method without Guava parameters instead<B,REQUEST extends BmcRequest<B>,RESPONSE>
Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>>postFutureSupplier(REQUEST interceptedRequest, Object body, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)Return the function that, given anAsyncHandler, makes the post request and returns the future<T extends BmcRequest>
javax.ws.rs.core.Responseput(WrappedInvocationBuilder ib, Object body, T request)Put a request object to the endpoint represented by the web target and get the response.<T extends BmcRequest>
Future<javax.ws.rs.core.Response>put(WrappedInvocationBuilder ib, Object body, T request, Consumer<javax.ws.rs.core.Response> onSuccess, Consumer<Throwable> onError)Put a request object to the endpoint represented by the web target asynchronously and get the response.<T extends BmcRequest>
javax.ws.rs.core.Responseput(WrappedInvocationBuilder ib, T request)Put a request object without body to the endpoint represented by the web target and get the response.<T extends BmcRequest>
Future<javax.ws.rs.core.Response>put(WrappedInvocationBuilder ib, T request, Consumer<javax.ws.rs.core.Response> onSuccess, Consumer<Throwable> onError)Put a request object without body to the endpoint represented by the web target asynchronously and get the response.<B,REQUEST extends BmcRequest<B>,RESPONSE>
Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>>putFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)Deprecated.use the method without Guava parameters instead<B,REQUEST extends BmcRequest<B>,RESPONSE>
Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>>putFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)Return the function that, given anAsyncHandler, makes the put request and returns the future<B,REQUEST extends BmcRequest<B>,RESPONSE>
Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>>putFutureSupplier(REQUEST interceptedRequest, Object body, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)Deprecated.use the method without Guava parameters instead<B,REQUEST extends BmcRequest<B>,RESPONSE>
Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>>putFutureSupplier(REQUEST interceptedRequest, Object body, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)Return the function that, given anAsyncHandler, makes the put request and returns the futurevoidsetEndpoint(String endpoint)Sets the endpoint that this client should talk to.voidsetOptionsMap(Map<String,Boolean> optionsMap)voidsetRequestUri(String requestUri)Sets the requestURI for this client.
-
-
-
Constructor Detail
-
RestClient
public RestClient(@Nonnull javax.ws.rs.client.Client client, @Nonnull EntityFactory entityFactory, JaxRsCircuitBreaker circuitBreaker)
Create a new client that uses a provided client to make all its requests.It’s up to the caller to properly configure the client.
- Parameters:
client- A HTTP client to make all requests with.entityFactory- An entity factory to create entities for POST/PUT operations.circuitBreaker- A circuit breaker instance to decorate http client
-
RestClient
public RestClient(@Nonnull javax.ws.rs.client.Client client, @Nonnull EntityFactory entityFactory, JaxRsCircuitBreaker circuitBreaker, boolean isApacheNonBufferingClient)
Create a new client that uses a provided client to make all its requests.It’s up to the caller to properly configure the client.
- Parameters:
client- A HTTP client to make all requests with.entityFactory- An entity factory to create entities for POST/PUT operations.circuitBreaker- A circuit breaker instance to decorate http clientisApacheNonBufferingClient- A boolean value to disable buffering of entities in memory for Apache client
-
RestClient
public RestClient(@Nonnull javax.ws.rs.client.Client client, @Nonnull EntityFactory entityFactory, JaxRsCircuitBreaker circuitBreaker, boolean isApacheNonBufferingClient, ClientConfigurator clientConfigurator)
Create a new client that uses a provided client to make all its requests.It’s up to the caller to properly configure the client.
- Parameters:
client- A HTTP client to make all requests with.entityFactory- An entity factory to create entities for POST/PUT operations.circuitBreaker- A circuit breaker instance to decorate http clientisApacheNonBufferingClient- A boolean value to disable buffering of entities in memory for Apache clientclientConfigurator- The client configurator used when creating the client
-
-
Method Detail
-
setEndpoint
public void setEndpoint(@Nonnull String endpoint)
Sets the endpoint that this client should talk to.- Parameters:
endpoint- The endpoint.
-
getEndpoint
public String getEndpoint()
Gets the endpoint that this client should talk to.- Returns:
- endpoint
-
getClient
public javax.ws.rs.client.Client getClient()
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
getBaseTarget
public WrappedWebTarget getBaseTarget()
Gets the target (endpoint) for this client.- Returns:
- The target.
-
getRequestUri
public String getRequestUri()
Gets the requestURI for this client.- Returns:
- the requestURI
-
setRequestUri
public void setRequestUri(@Nonnull String requestUri)
Sets the requestURI for this client.
-
getCircuitBreaker
public JaxRsCircuitBreaker getCircuitBreaker()
Gets the underlying circuitBreaker implementation for this client- Returns:
- CircuitBreaker
-
get
public <T extends BmcRequest> javax.ws.rs.core.Response get(@Nonnull WrappedInvocationBuilder ib, @Nonnull T request) throws BmcException
Request a resource.- Parameters:
ib- The invocation builder to use when making the request.request- The original client request object given to the service client.- Returns:
- The
Responseobject. - Throws:
BmcException- If an error was encountered while invoking the request.
-
get
public <T extends BmcRequest> Future<javax.ws.rs.core.Response> get(@Nonnull WrappedInvocationBuilder ib, @Nonnull T request, @Nullable Consumer<javax.ws.rs.core.Response> onSuccess, @Nullable Consumer<Throwable> onError)
Request a resource asynchronously.- Parameters:
ib- The invocation builder to use when making the request.request- The original client request object given to the service client.onSuccess- The callback to invoke on success.onError- The callback to invoke on failure.- Returns:
- A Future that can be used to get the Response if no Consumer was provided. Note, callers should be careful not to read the entity from both the future and the consumer, as the entity stream may not be able to support being consumed twice.
-
getFutureSupplier
public <B,REQUEST extends BmcRequest<B>,RESPONSE> Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>> getFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)
Return the function that, given anAsyncHandler, makes the get request and returns the future.- Type Parameters:
B- type of the bodyREQUEST- type of the requestRESPONSE- type of the response- Parameters:
interceptedRequest- intercepted requestib- invocation buildertransformer- transformer from JAX-RS response to model response- Returns:
- future for the get request
-
getFutureSupplier
@Deprecated public <B,REQUEST extends BmcRequest<B>,RESPONSE> Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>> getFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)
Deprecated.Use the method without Guava parameters insteadReturn the function that, given anAsyncHandler, makes the get request and returns the future.- Type Parameters:
B- type of the bodyREQUEST- type of the requestRESPONSE- type of the response- Parameters:
interceptedRequest- intercepted requestib- invocation buildertransformer- transformer from JAX-RS response to model response- Returns:
- future for the get request
-
post
public <T extends BmcRequest> javax.ws.rs.core.Response post(@Nonnull WrappedInvocationBuilder ib, @Nullable Object body, @Nonnull T request) throws BmcException
Post a request object to the endpoint represented by the web target and get the response.- Parameters:
ib- An invocation builder to execute requests with.body- The content body to post to the web target.request- The original client request object given to the service client.- Returns:
- The
Responseobject. - Throws:
BmcException- If an error was encountered while invoking the request.
-
post
public <T extends BmcRequest> Future<javax.ws.rs.core.Response> post(@Nonnull WrappedInvocationBuilder ib, @Nullable Object body, @Nonnull T request, @Nullable Consumer<javax.ws.rs.core.Response> onSuccess, @Nullable Consumer<Throwable> onError)
Post a request object to the endpoint represented by the web target asynchronously and get the response.- Parameters:
ib- An invocation builder to execute requests with.body- The content body to post to the web target.request- The original client request object given to the service client.onSuccess- The callback to invoke on success.onError- The callback to invoke on failure.- Returns:
- A Future that can be used to get the Response if no Consumer was provided. Note, callers should be careful not to read the entity from both the future and the consumer, as the entity stream may not be able to support being consumed twice.
-
postFutureSupplier
public <B,REQUEST extends BmcRequest<B>,RESPONSE> Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>> postFutureSupplier(REQUEST interceptedRequest, Object body, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)
Return the function that, given anAsyncHandler, makes the post request and returns the future- Type Parameters:
B- type of the bodyREQUEST- type of the requestRESPONSE- type of the response- Parameters:
interceptedRequest- intercepted requestbody- the body of the requestib- invocation buildertransformer- transformer from JAX-RS response to model response- Returns:
- future for the post request
-
postFutureSupplier
@Deprecated public <B,REQUEST extends BmcRequest<B>,RESPONSE> Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>> postFutureSupplier(REQUEST interceptedRequest, Object body, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)
Deprecated.use the method without Guava parameters insteadReturn the function that, given anAsyncHandler, makes the post request and returns the future- Type Parameters:
B- type of the bodyREQUEST- type of the requestRESPONSE- type of the response- Parameters:
interceptedRequest- intercepted requestbody- the body of the requestib- invocation buildertransformer- transformer from JAX-RS response to model response- Returns:
- future for the post request
-
postFutureSupplier
public <B,REQUEST extends BmcRequest<B>,RESPONSE> Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>> postFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)
Return the function that, given anAsyncHandler, makes the post request and returns the future- Type Parameters:
B- type of the bodyREQUEST- type of the requestRESPONSE- type of the response- Parameters:
interceptedRequest- intercepted requestib- invocation buildertransformer- transformer from JAX-RS response to model response- Returns:
- future for the post request
-
postFutureSupplier
@Deprecated public <B,REQUEST extends BmcRequest<B>,RESPONSE> Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>> postFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)
Deprecated.use method without GUava parameters insteadReturn the function that, given anAsyncHandler, makes the post request and returns the future- Type Parameters:
B- type of the bodyREQUEST- type of the requestRESPONSE- type of the response- Parameters:
interceptedRequest- intercepted requestib- invocation buildertransformer- transformer from JAX-RS response to model response- Returns:
- future for the post request
-
post
public <T extends BmcRequest> javax.ws.rs.core.Response post(@Nonnull WrappedInvocationBuilder ib, @Nonnull T request)
Post an empty body to the endpoint represented by the web target and get the response.- Parameters:
ib- An invocation builder to execute requests with.request- The original client request object given to the service client.- Returns:
- The
Responseobject. - Throws:
BmcException- If an error was encountered while invoking the request.
-
post
public <T extends BmcRequest> Future<javax.ws.rs.core.Response> post(@Nonnull WrappedInvocationBuilder ib, @Nonnull T request, @Nullable Consumer<javax.ws.rs.core.Response> onSuccess, @Nullable Consumer<Throwable> onError)
Post an empty body to the endpoint represented by the web target asynchronously and get the response.- Parameters:
ib- An invocation builder to execute requests with.request- The original client request object given to the service client.onSuccess- The callback to invoke on success.onError- The callback to invoke on failure.- Returns:
- A Future that can be used to get the Response if no Consumer was provided. Note, callers should be careful not to read the entity from both the future and the consumer, as the entity stream may not be able to support being consumed twice.
-
patch
public <T extends BmcRequest> javax.ws.rs.core.Response patch(@Nonnull WrappedInvocationBuilder ib, @Nonnull T request)
Patch a request object without body to the endpoint represented by the web target and get the response.- Parameters:
ib- An invocation builder to execute requests with.request- The original client request object given to the service client.- Returns:
- The
Responseobject. - Throws:
BmcException- If an error was encountered while invoking the request.
-
patch
public <T extends BmcRequest> javax.ws.rs.core.Response patch(@Nonnull WrappedInvocationBuilder ib, @Nullable Object body, @Nonnull T request) throws BmcException
Patch a request object to the endpoint represented by the web target and get the response.- Parameters:
ib- An invocation builder to execute requests with.body- The content body to post to the web target.request- The original client request object given to the service client.- Returns:
- The
Responseobject. - Throws:
BmcException- If an error was encountered while invoking the request.
-
patch
public <T extends BmcRequest> Future<javax.ws.rs.core.Response> patch(@Nonnull WrappedInvocationBuilder ib, @Nonnull T request, @Nullable Consumer<javax.ws.rs.core.Response> onSuccess, @Nullable Consumer<Throwable> onError)
Patch a request object without body to the endpoint represented by the web target asynchronously and get the response.- Parameters:
ib- An invocation builder to execute requests with.request- The original client request object given to the service client.onSuccess- The callback to invoke on success.onError- The callback to invoke on failure.- Returns:
- A Future that can be used to get the Response if no Consumer was provided. Note, callers should be careful not to read the entity from both the future and the consumer, as the entity stream may not be able to support being consumed twice.
-
patch
public <T extends BmcRequest> Future<javax.ws.rs.core.Response> patch(@Nonnull WrappedInvocationBuilder ib, @Nullable Object body, @Nonnull T request, @Nullable Consumer<javax.ws.rs.core.Response> onSuccess, @Nullable Consumer<Throwable> onError)
Patch a request object to the endpoint represented by the web target asynchronously and get the response.- Parameters:
ib- An invocation builder to execute requests with.body- The content body object to post to the web target.request- The original client request object given to the service client.onSuccess- The callback to invoke on success.onError- The callback to invoke on failure.- Returns:
- A Future that can be used to get the Response if no Consumer was provided. Note, callers should be careful not to read the entity from both the future and the consumer, as the entity stream may not be able to support being consumed twice.
-
patchFutureSupplier
public <B,REQUEST extends BmcRequest<B>,RESPONSE> Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>> patchFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)
Return the function that, given anAsyncHandler, makes the patch request and returns the future- Type Parameters:
B- type of the bodyREQUEST- type of the requestRESPONSE- type of the response- Parameters:
interceptedRequest- intercepted requestib- invocation buildertransformer- transformer from JAX-RS response to model response- Returns:
- future for the patch request
-
patchFutureSupplier
@Deprecated public <B,REQUEST extends BmcRequest<B>,RESPONSE> Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>> patchFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)
Deprecated.use method without Guava parameters insteadReturn the function that, given anAsyncHandler, makes the patch request and returns the future- Type Parameters:
B- type of the bodyREQUEST- type of the requestRESPONSE- type of the response- Parameters:
interceptedRequest- intercepted requestib- invocation buildertransformer- transformer from JAX-RS response to model response- Returns:
- future for the patch request
-
patchFutureSupplier
public <B,REQUEST extends BmcRequest<B>,RESPONSE> Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>> patchFutureSupplier(REQUEST interceptedRequest, Object body, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)
Return the function that, given anAsyncHandler, makes the patch request and returns the future- Type Parameters:
B- type of the bodyREQUEST- type of the requestRESPONSE- type of the response- Parameters:
interceptedRequest- intercepted requestbody- the body of the requestib- invocation buildertransformer- transformer from JAX-RS response to model response- Returns:
- future for the patch request
-
patchFutureSupplier
@Deprecated public <B,REQUEST extends BmcRequest<B>,RESPONSE> Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>> patchFutureSupplier(REQUEST interceptedRequest, Object body, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)
Deprecated.use method without Guava parameters insteadReturn the function that, given anAsyncHandler, makes the patch request and returns the future- Type Parameters:
B- type of the bodyREQUEST- type of the requestRESPONSE- type of the response- Parameters:
interceptedRequest- intercepted requestbody- the body of the requestib- invocation buildertransformer- transformer from JAX-RS response to model response- Returns:
- future for the patch request
-
put
public <T extends BmcRequest> javax.ws.rs.core.Response put(@Nonnull WrappedInvocationBuilder ib, @Nonnull T request)
Put a request object without body to the endpoint represented by the web target and get the response.- Parameters:
ib- An invocation builder to execute requests with.request- The original client request object given to the service client.- Returns:
- The
Responseobject. - Throws:
BmcException- If an error was encountered while invoking the request.
-
put
public <T extends BmcRequest> javax.ws.rs.core.Response put(@Nonnull WrappedInvocationBuilder ib, @Nullable Object body, @Nonnull T request) throws BmcException
Put a request object to the endpoint represented by the web target and get the response.- Parameters:
ib- An invocation builder to execute requests with.body- The content body to post to the web target.request- The original client request object given to the service client.- Returns:
- The
Responseobject. - Throws:
BmcException- If an error was encountered while invoking the request.
-
put
public <T extends BmcRequest> Future<javax.ws.rs.core.Response> put(@Nonnull WrappedInvocationBuilder ib, @Nonnull T request, @Nullable Consumer<javax.ws.rs.core.Response> onSuccess, @Nullable Consumer<Throwable> onError)
Put a request object without body to the endpoint represented by the web target asynchronously and get the response.- Parameters:
ib- An invocation builder to execute requests with.request- The original client request object given to the service client.onSuccess- The callback to invoke on success.onError- The callback to invoke on failure.- Returns:
- A Future that can be used to get the Response if no Consumer was provided. Note, callers should be careful not to read the entity from both the future and the consumer, as the entity stream may not be able to support being consumed twice.
-
put
public <T extends BmcRequest> Future<javax.ws.rs.core.Response> put(@Nonnull WrappedInvocationBuilder ib, @Nullable Object body, @Nonnull T request, @Nullable Consumer<javax.ws.rs.core.Response> onSuccess, @Nullable Consumer<Throwable> onError)
Put a request object to the endpoint represented by the web target asynchronously and get the response.- Parameters:
ib- An invocation builder to execute requests with.body- The content body to post to the web target.request- The original client request object given to the service client.onSuccess- The callback to invoke on success.onError- The callback to invoke on failure.- Returns:
- A Future that can be used to get the Response if no Consumer was provided. Note, callers should be careful not to read the entity from both the future and the consumer, as the entity stream may not be able to support being consumed twice.
-
putFutureSupplier
public <B,REQUEST extends BmcRequest<B>,RESPONSE> Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>> putFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)
Return the function that, given anAsyncHandler, makes the put request and returns the future- Type Parameters:
B- type of the bodyREQUEST- type of the requestRESPONSE- type of the response- Parameters:
interceptedRequest- intercepted requestib- invocation buildertransformer- transformer from JAX-RS response to model response- Returns:
- future for the put request
-
putFutureSupplier
@Deprecated public <B,REQUEST extends BmcRequest<B>,RESPONSE> Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>> putFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)
Deprecated.use the method without Guava parameters insteadReturn the function that, given anAsyncHandler, makes the put request and returns the future- Type Parameters:
B- type of the bodyREQUEST- type of the requestRESPONSE- type of the response- Parameters:
interceptedRequest- intercepted requestib- invocation buildertransformer- transformer from JAX-RS response to model response- Returns:
- future for the put request
-
putFutureSupplier
public <B,REQUEST extends BmcRequest<B>,RESPONSE> Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>> putFutureSupplier(REQUEST interceptedRequest, Object body, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)
Return the function that, given anAsyncHandler, makes the put request and returns the future- Type Parameters:
B- type of the bodyREQUEST- type of the requestRESPONSE- type of the response- Parameters:
interceptedRequest- intercepted requestbody- the body of the requestib- invocation buildertransformer- transformer from JAX-RS response to model response- Returns:
- future for the put request
-
putFutureSupplier
@Deprecated public <B,REQUEST extends BmcRequest<B>,RESPONSE> Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>> putFutureSupplier(REQUEST interceptedRequest, Object body, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)
Deprecated.use the method without Guava parameters insteadReturn the function that, given anAsyncHandler, makes the put request and returns the future- Type Parameters:
B- type of the bodyREQUEST- type of the requestRESPONSE- type of the response- Parameters:
interceptedRequest- intercepted requestbody- the body of the requestib- invocation buildertransformer- transformer from JAX-RS response to model response- Returns:
- future for the put request
-
delete
public <T extends BmcRequest> javax.ws.rs.core.Response delete(@Nonnull WrappedInvocationBuilder ib, @Nonnull T request) throws BmcException
Execute a delete on a resource and get the response.- Parameters:
ib- An invocation builder to execute requests with.request- The original client request object given to the service client.- Returns:
- The
Responseobject. - Throws:
BmcException- If an error was encountered while invoking the request.
-
delete
public <T extends BmcRequest> Future<javax.ws.rs.core.Response> delete(@Nonnull WrappedInvocationBuilder ib, @Nonnull T request, @Nullable Consumer<javax.ws.rs.core.Response> onSuccess, @Nullable Consumer<Throwable> onError)
Execute a delete on a resource asynchronously and get the response.- Parameters:
ib- An invocation builder to execute requests with.request- The original client request object given to the service client.onSuccess- The callback to invoke on success.onError- The callback to invoke on failure.- Returns:
- A Future that can be used to get the Response if no Consumer was provided. Note, callers should be careful not to read the entity from both the future and the consumer, as the entity stream may not be able to support being consumed twice.
-
deleteFutureSupplier
public <B,REQUEST extends BmcRequest<B>,RESPONSE> Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>> deleteFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)
Return the function that, given anAsyncHandler, makes the delete request and returns the future.- Type Parameters:
B- type of the bodyREQUEST- type of the requestRESPONSE- type of the response- Parameters:
interceptedRequest- intercepted requestib- invocation buildertransformer- transformer from JAX-RS response to model response- Returns:
- future for the post request
-
deleteFutureSupplier
@Deprecated public <B,REQUEST extends BmcRequest<B>,RESPONSE> Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>> deleteFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)
Deprecated.use the method without Guava parameters insteadReturn the function that, given anAsyncHandler, makes the delete request and returns the future.- Type Parameters:
B- type of the bodyREQUEST- type of the requestRESPONSE- type of the response- Parameters:
interceptedRequest- intercepted requestib- invocation buildertransformer- transformer from JAX-RS response to model response- Returns:
- future for the post request
-
head
public <T extends BmcRequest> javax.ws.rs.core.Response head(@Nonnull WrappedInvocationBuilder ib, @Nonnull T request) throws BmcException
Execute a head request for a resource and return the response.- Parameters:
ib- An invocation builder to execute requests with.request- The original client request object given to the service client.- Returns:
- The
Responseobject. - Throws:
BmcException- If an error was encountered while invoking the request.
-
head
public <T extends BmcRequest> Future<javax.ws.rs.core.Response> head(@Nonnull WrappedInvocationBuilder ib, @Nonnull T request, @Nullable Consumer<javax.ws.rs.core.Response> onSuccess, @Nullable Consumer<Throwable> onError)
Execute a head request for a resource asynchronously and return the response.- Parameters:
ib- An invocation builder to execute requests with.request- The original client request object given to the service client.onSuccess- The callback to invoke on success.onError- The callback to invoke on failure.- Returns:
- A Future that can be used to get the Response if no Consumer was provided. Note, callers should be careful not to read the entity from both the future and the consumer, as the entity stream may not be able to support being consumed twice.
-
headFutureSupplier
public <B,REQUEST extends BmcRequest<B>,RESPONSE> Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>> headFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)
Return the function that, given anAsyncHandler, makes the head request and returns the future.- Type Parameters:
B- type of the bodyREQUEST- type of the requestRESPONSE- type of the response- Parameters:
interceptedRequest- intercepted requestib- invocation buildertransformer- transformer from JAX-RS response to model response- Returns:
- future for the head request
-
headFutureSupplier
@Deprecated public <B,REQUEST extends BmcRequest<B>,RESPONSE> Function<AsyncHandler<REQUEST,RESPONSE>,Future<RESPONSE>> headFutureSupplier(REQUEST interceptedRequest, WrappedInvocationBuilder ib, Function<javax.ws.rs.core.Response,RESPONSE> transformer)
Deprecated.use method without Guava parameters insteadReturn the function that, given anAsyncHandler, makes the head request and returns the future.- Type Parameters:
B- type of the bodyREQUEST- type of the requestRESPONSE- type of the response- Parameters:
interceptedRequest- intercepted requestib- invocation buildertransformer- transformer from JAX-RS response to model response- Returns:
- future for the head request
-
generateRequestId
public static String generateRequestId()
-
getClientConfigurator
public ClientConfigurator getClientConfigurator()
The client configurator used for configuring the client.May be null.
-
-