Class 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 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 client
        isApacheNonBufferingClient - 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 client
        isApacheNonBufferingClient - A boolean value to disable buffering of entities in memory for Apache client
        clientConfigurator - 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()
      • 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 Response object.
        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 an AsyncHandler, makes the get request and returns the future.
        Type Parameters:
        B - type of the body
        REQUEST - type of the request
        RESPONSE - type of the response
        Parameters:
        interceptedRequest - intercepted request
        ib - invocation builder
        transformer - 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 instead
        Return the function that, given an AsyncHandler, makes the get request and returns the future.
        Type Parameters:
        B - type of the body
        REQUEST - type of the request
        RESPONSE - type of the response
        Parameters:
        interceptedRequest - intercepted request
        ib - invocation builder
        transformer - 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 Response object.
        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 an AsyncHandler, makes the post request and returns the future
        Type Parameters:
        B - type of the body
        REQUEST - type of the request
        RESPONSE - type of the response
        Parameters:
        interceptedRequest - intercepted request
        body - the body of the request
        ib - invocation builder
        transformer - 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 instead
        Return the function that, given an AsyncHandler, makes the post request and returns the future
        Type Parameters:
        B - type of the body
        REQUEST - type of the request
        RESPONSE - type of the response
        Parameters:
        interceptedRequest - intercepted request
        body - the body of the request
        ib - invocation builder
        transformer - 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 an AsyncHandler, makes the post request and returns the future
        Type Parameters:
        B - type of the body
        REQUEST - type of the request
        RESPONSE - type of the response
        Parameters:
        interceptedRequest - intercepted request
        ib - invocation builder
        transformer - 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 instead
        Return the function that, given an AsyncHandler, makes the post request and returns the future
        Type Parameters:
        B - type of the body
        REQUEST - type of the request
        RESPONSE - type of the response
        Parameters:
        interceptedRequest - intercepted request
        ib - invocation builder
        transformer - 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 Response object.
        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 Response object.
        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 Response object.
        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 an AsyncHandler, makes the patch request and returns the future
        Type Parameters:
        B - type of the body
        REQUEST - type of the request
        RESPONSE - type of the response
        Parameters:
        interceptedRequest - intercepted request
        ib - invocation builder
        transformer - 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 instead
        Return the function that, given an AsyncHandler, makes the patch request and returns the future
        Type Parameters:
        B - type of the body
        REQUEST - type of the request
        RESPONSE - type of the response
        Parameters:
        interceptedRequest - intercepted request
        ib - invocation builder
        transformer - 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 an AsyncHandler, makes the patch request and returns the future
        Type Parameters:
        B - type of the body
        REQUEST - type of the request
        RESPONSE - type of the response
        Parameters:
        interceptedRequest - intercepted request
        body - the body of the request
        ib - invocation builder
        transformer - 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 instead
        Return the function that, given an AsyncHandler, makes the patch request and returns the future
        Type Parameters:
        B - type of the body
        REQUEST - type of the request
        RESPONSE - type of the response
        Parameters:
        interceptedRequest - intercepted request
        body - the body of the request
        ib - invocation builder
        transformer - 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 Response object.
        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 Response object.
        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 an AsyncHandler, makes the put request and returns the future
        Type Parameters:
        B - type of the body
        REQUEST - type of the request
        RESPONSE - type of the response
        Parameters:
        interceptedRequest - intercepted request
        ib - invocation builder
        transformer - 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 instead
        Return the function that, given an AsyncHandler, makes the put request and returns the future
        Type Parameters:
        B - type of the body
        REQUEST - type of the request
        RESPONSE - type of the response
        Parameters:
        interceptedRequest - intercepted request
        ib - invocation builder
        transformer - 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 an AsyncHandler, makes the put request and returns the future
        Type Parameters:
        B - type of the body
        REQUEST - type of the request
        RESPONSE - type of the response
        Parameters:
        interceptedRequest - intercepted request
        body - the body of the request
        ib - invocation builder
        transformer - 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 instead
        Return the function that, given an AsyncHandler, makes the put request and returns the future
        Type Parameters:
        B - type of the body
        REQUEST - type of the request
        RESPONSE - type of the response
        Parameters:
        interceptedRequest - intercepted request
        body - the body of the request
        ib - invocation builder
        transformer - 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 Response object.
        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 an AsyncHandler, makes the delete request and returns the future.
        Type Parameters:
        B - type of the body
        REQUEST - type of the request
        RESPONSE - type of the response
        Parameters:
        interceptedRequest - intercepted request
        ib - invocation builder
        transformer - 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 instead
        Return the function that, given an AsyncHandler, makes the delete request and returns the future.
        Type Parameters:
        B - type of the body
        REQUEST - type of the request
        RESPONSE - type of the response
        Parameters:
        interceptedRequest - intercepted request
        ib - invocation builder
        transformer - 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 Response object.
        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 an AsyncHandler, makes the head request and returns the future.
        Type Parameters:
        B - type of the body
        REQUEST - type of the request
        RESPONSE - type of the response
        Parameters:
        interceptedRequest - intercepted request
        ib - invocation builder
        transformer - 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 instead
        Return the function that, given an AsyncHandler, makes the head request and returns the future.
        Type Parameters:
        B - type of the body
        REQUEST - type of the request
        RESPONSE - type of the response
        Parameters:
        interceptedRequest - intercepted request
        ib - invocation builder
        transformer - transformer from JAX-RS response to model response
        Returns:
        future for the head request
      • setOptionsMap

        public void setOptionsMap​(Map<String,​Boolean> optionsMap)
      • generateRequestId

        public static String generateRequestId()
      • getClientConfigurator

        public ClientConfigurator getClientConfigurator()
        The client configurator used for configuring the client.

        May be null.