com.holonplatform.async.http.internal

## Class AbstractAsyncRestClient

- java.lang.Object
- - com.holonplatform.async.http.internal.AbstractAsyncRestClient

- All Implemented Interfaces:
    AsyncRestClient, AsyncInvoker, RestClientOperations<AsyncRestClient,AsyncRestClient.AsyncRequestDefinition>

      public abstract class AbstractAsyncRestClient
      extends Object
      implements AsyncRestClient, AsyncInvoker

  Abstract `AsyncRestClient` implementation.
  Since:
    5.2.0

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.holonplatform.async.http.AsyncRestClient

      `AsyncRestClient.AsyncInvocation, AsyncRestClient.AsyncRequestDefinition`

    - ### Nested classes/interfaces inherited from interface com.holonplatform.http.rest.RestClientOperations

      `RestClientOperations.InvocationOperations<RE,RP,RS,RL,RU>, RestClientOperations.RequestConfiguration<R extends RestClientOperations.RequestConfiguration<R>>`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractAsyncRestClient()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `AsyncRestClient` | `clearDefaultHeaders()` Removes all default headers
    `AsyncRestClient` | `defaultTarget(URI baseUri)` Set the default target request base URI, which will be used as target URI for every request configured using `RestClientOperations.request()`, if not overridden using `RestClientOperations.RequestConfiguration.target(URI)`.
    `Optional<URI>` | `getDefaultTarget()` Get the default target request base URI, which will be used as target URI for every request configured using `RestClientOperations.request()`, if not overridden using `RestClientOperations.RequestConfiguration.target(URI)`.
    `AsyncRestClient` | `removeDefaultHeader(String name)` Removes the default header with given `name`, if present
    `AsyncRestClient.AsyncRequestDefinition` | `request()` Create a new request definition, to be used to configure request and invoke response.
    `AsyncRestClient` | `withDefaultHeader(String name, String value)` Add a default request header which will be automatically added to every invocation request message, if an header with the same name is not already present.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.holonplatform.async.http.AsyncRestClient

      `create, create, create, create, forTarget, forTarget`

    - ### Methods inherited from interface com.holonplatform.async.http.internal.AsyncInvoker

      `invoke`

- - ### Constructor Detail

    - #### AbstractAsyncRestClient

          public AbstractAsyncRestClient()

  - ### Method Detail

    - #### defaultTarget

          public AsyncRestClient defaultTarget(URI baseUri)

      Description copied from interface: `RestClientOperations`
      Set the default target request base URI, which will be used as target URI for every request configured using `RestClientOperations.request()`, if not overridden using `RestClientOperations.RequestConfiguration.target(URI)`.

      URI template parameters are not supported for the base target URI.

      Specified by:
        `defaultTarget` in interface `RestClientOperations<AsyncRestClient,AsyncRestClient.AsyncRequestDefinition>`
      Parameters:
        `baseUri` - Default target request base URI
      Returns:
        The updated RestClient

    - #### getDefaultTarget

          public Optional<URI> getDefaultTarget()

      Description copied from interface: `RestClientOperations`
      Get the default target request base URI, which will be used as target URI for every request configured using `RestClientOperations.request()`, if not overridden using `RestClientOperations.RequestConfiguration.target(URI)`.
      Specified by:
        `getDefaultTarget` in interface `RestClientOperations<AsyncRestClient,AsyncRestClient.AsyncRequestDefinition>`
      Returns:
        Default target request base URI, if setted

    - #### withDefaultHeader

          public AsyncRestClient withDefaultHeader(String name,
                                                   String value)

      Description copied from interface: `RestClientOperations`
      Add a default request header which will be automatically added to every invocation request message, if an header with the same name is not already present.
      Specified by:
        `withDefaultHeader` in interface `RestClientOperations<AsyncRestClient,AsyncRestClient.AsyncRequestDefinition>`
      Parameters:
        `name` - Header name (not null)
        `value` - Header value
      Returns:
        The updated RestClient

    - #### removeDefaultHeader

          public AsyncRestClient removeDefaultHeader(String name)

      Description copied from interface: `RestClientOperations`
      Removes the default header with given `name`, if present
      Specified by:
        `removeDefaultHeader` in interface `RestClientOperations<AsyncRestClient,AsyncRestClient.AsyncRequestDefinition>`
      Parameters:
        `name` - Header name to remove (not null)
      Returns:
        The updated RestClient

    - #### clearDefaultHeaders

          public AsyncRestClient clearDefaultHeaders()

      Description copied from interface: `RestClientOperations`
      Removes all default headers
      Specified by:
        `clearDefaultHeaders` in interface `RestClientOperations<AsyncRestClient,AsyncRestClient.AsyncRequestDefinition>`
      Returns:
        The updated RestClient

    - #### request

          public AsyncRestClient.AsyncRequestDefinition request()

      Description copied from interface: `RestClientOperations`
      Create a new request definition, to be used to configure request and invoke response.

      If a default target request URI is configured using `RestClientOperations.defaultTarget(URI)`, this will be used as request base URI. The target URI can be overridden using `RestClientOperations.RequestConfiguration.target(URI)`.

      Specified by:
        `request` in interface `RestClientOperations<AsyncRestClient,AsyncRestClient.AsyncRequestDefinition>`
      Returns:
        Request definition builder

Copyright © 2019 The Holon Platform. All rights reserved.