com.holonplatform.async.http.internal

## Class DefaultAsyncRequestDefinition

- java.lang.Object
- - com.holonplatform.http.internal.rest.AbstractRequestDefinition<AsyncRestClient.AsyncRequestDefinition>
  - - com.holonplatform.async.http.internal.DefaultAsyncRequestDefinition

- All Implemented Interfaces:
    AsyncRestClient.AsyncInvocation, AsyncRestClient.AsyncRequestDefinition, RestClientOperations.InvocationOperations<CompletionStage<?>,CompletionStage<?>,CompletionStage<InputStream>,CompletionStage<?>,CompletionStage<Optional<URI>>>, RestClientOperations.RequestConfiguration<AsyncRestClient.AsyncRequestDefinition>

      public class DefaultAsyncRequestDefinition
      extends com.holonplatform.http.internal.rest.AbstractRequestDefinition<AsyncRestClient.AsyncRequestDefinition>
      implements AsyncRestClient.AsyncRequestDefinition

  Default `AsyncRestClient.AsyncRequestDefinition` implementation.
  Since:
    5.2.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultAsyncRequestDefinition(AsyncInvoker invoker)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T,R> CompletionStage<ResponseEntity<T>>` | `invoke(HttpMethod method, RequestEntity<R> requestEntity, ResponseType<T> responseType)` Invoke the request and asynchronously receive a response back.
    `<T,R> CompletionStage<Optional<T>>` | `invokeForEntity(HttpMethod method, RequestEntity<R> requestEntity, ResponseType<T> responseType)` Invoke the request and asynchronously receive back the response content entity.
    `<T,R> CompletionStage<ResponseEntity<T>>` | `invokeForSuccess(HttpMethod method, RequestEntity<R> requestEntity, ResponseType<T> responseType)` Invoke the request and asynchronously receive a response back only if the response has a success (`2xx`) status code.

    - ### Methods inherited from class com.holonplatform.http.internal.rest.AbstractRequestDefinition

      `accept, accept, acceptCharset, acceptCharset, acceptEncoding, acceptLanguage, acceptLanguage, authorizationBasic, authorizationBearer, cacheControl, getBaseRequestURI, getHeaders, getPropertySet, getQueryParameters, getRequestPath, getRequestURI, getTemplateParameters, header, path, propertySet, propertySet, queryParameter, resolve, resolve, target, toString`

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

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

    - ### Methods inherited from interface com.holonplatform.http.rest.RestClientOperations.RequestConfiguration

      `accept, accept, acceptCharset, acceptCharset, acceptEncoding, acceptLanguage, acceptLanguage, authorizationBasic, authorizationBearer, cacheControl, getBaseRequestURI, getHeaders, getPropertySet, getQueryParameters, getRequestPath, getRequestURI, getTemplateParameters, header, path, propertySet, propertySet, queryParameter, resolve, resolve, target, target`

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

      `delete, delete, delete, deleteForEntity, deleteForEntity, deleteOrFail, get, get, getAsList, getForEntity, getForEntity, getForStream, head, options, options, options, optionsForEntity, optionsForEntity, patch, patch, patch, patchForEntity, patchForEntity, post, post, post, postForEntity, postForEntity, postForLocation, put, put, put, putForEntity, putForEntity, trace, trace, trace, traceForEntity, traceForEntity`

- - ### Constructor Detail

    - #### DefaultAsyncRequestDefinition

          public DefaultAsyncRequestDefinition(AsyncInvoker invoker)

      Constructor.
      Parameters:
        `invoker` - Invoker to use to invoke for response

  - ### Method Detail

    - #### invoke

          public <T,R> CompletionStage<ResponseEntity<T>> invoke(HttpMethod method,
                                                                 RequestEntity<R> requestEntity,
                                                                 ResponseType<T> responseType)

      Description copied from interface: `AsyncRestClient.AsyncInvocation`
      Invoke the request and asynchronously receive a response back.

      The response payload is processed and possibly converted by concrete client implementation.

      Specified by:
        `invoke` in interface `AsyncRestClient.AsyncInvocation`
      Specified by:
        `invoke` in interface `RestClientOperations.InvocationOperations<CompletionStage<?>,CompletionStage<?>,CompletionStage<InputStream>,CompletionStage<?>,CompletionStage<Optional<URI>>>`
      Type Parameters:
        `T` - Response type
        `R` - Request entity type
      Parameters:
        `method` - Request method
        `requestEntity` - Request entity
        `responseType` - Expected response payload type
      Returns:
        A `CompletionStage` to handle the `ResponseEntity` object as the result of the request invocation

    - #### invokeForSuccess

          public <T,R> CompletionStage<ResponseEntity<T>> invokeForSuccess(HttpMethod method,
                                                                           RequestEntity<R> requestEntity,
                                                                           ResponseType<T> responseType)

      Description copied from interface: `AsyncRestClient.AsyncInvocation`
      Invoke the request and asynchronously receive a response back only if the response has a success (`2xx`) status code.
      Specified by:
        `invokeForSuccess` in interface `AsyncRestClient.AsyncInvocation`
      Specified by:
        `invokeForSuccess` in interface `RestClientOperations.InvocationOperations<CompletionStage<?>,CompletionStage<?>,CompletionStage<InputStream>,CompletionStage<?>,CompletionStage<Optional<URI>>>`
      Type Parameters:
        `T` - Response type
        `R` - Request entity type
      Parameters:
        `method` - Request method
        `requestEntity` - Request entity
        `responseType` - Expected response payload type
      Returns:
        A `CompletionStage` to handle the `ResponseEntity` object as a result of the request invocation

    - #### invokeForEntity

          public <T,R> CompletionStage<Optional<T>> invokeForEntity(HttpMethod method,
                                                                    RequestEntity<R> requestEntity,
                                                                    ResponseType<T> responseType)

      Description copied from interface: `AsyncRestClient.AsyncInvocation`
      Invoke the request and asynchronously receive back the response content entity.
      Specified by:
        `invokeForEntity` in interface `AsyncRestClient.AsyncInvocation`
      Specified by:
        `invokeForEntity` in interface `RestClientOperations.InvocationOperations<CompletionStage<?>,CompletionStage<?>,CompletionStage<InputStream>,CompletionStage<?>,CompletionStage<Optional<URI>>>`
      Type Parameters:
        `T` - Response type
        `R` - Request entity type
      Parameters:
        `method` - Request method
        `requestEntity` - Request entity
        `responseType` - Expected response payload type
      Returns:
        A `CompletionStage` to handle the response payload of expected type as the result of the request invocation, or an empty Optional if not present (empty response entity)

Copyright © 2019 The Holon Platform. All rights reserved.