com.holonplatform.http.rest

## Interface RestClientOperations.RequestConfiguration<R extends RestClientOperations.RequestConfiguration<R>>

- Type Parameters:
    `R` - Concrete request type
  All Known Subinterfaces:
    AsyncRestClient.AsyncRequestDefinition, RestClient.RequestDefinition
  Enclosing interface:
    RestClientOperations<C extends RestClientOperations<C,R>,R extends RestClientOperations.RequestConfiguration<R> & RestClientOperations.InvocationOperations>

      public static interface RestClientOperations.RequestConfiguration<R extends RestClientOperations.RequestConfiguration<R>>

  Request configuration builder.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `R` | `accept(MediaType... mediaTypes)` Set the accepted response media types using `MediaType` enumeration.
    `R` | `accept(String... mediaTypes)` Set the accepted response media types.
    `R` | `acceptCharset(Charset... charsets)` Set the acceptable charsets.
    `R` | `acceptCharset(String... charsets)` Set the acceptable charsets.
    `R` | `acceptEncoding(String... encodings)` Set the acceptable encodings.
    `R` | `acceptLanguage(Locale... locales)` Set the acceptable languages.
    `R` | `acceptLanguage(String... locales)` Set the acceptable languages.
    `R` | `authorizationBasic(String username, String password)` Add an `HttpHeaders.AUTHORIZATION` header to request with scheme `HttpHeaders.SCHEME_BASIC` using given username and password.
    `R` | `authorizationBearer(String bearerToken)` Add an `HttpHeaders.AUTHORIZATION` header to request with scheme `HttpHeaders.SCHEME_BEARER` using given bearer token.
    `R` | `cacheControl(CacheControl cacheControl)` Set the Cache-Control header.
    `Optional<URI>` | `getBaseRequestURI()` Get the request base URI
    `Map<String,String>` | `getHeaders()` Get the request headers
    `Optional<PropertySet<?>>` | `getPropertySet()` Get the `PropertySet` to use to deserialize any `PropertyBox` contained in the response payload
    `Map<String,Object[]>` | `getQueryParameters()` Get the URI query parameters
    `Optional<String>` | `getRequestPath()` Get the request path to append to the base URI.
    `String` | `getRequestURI()` Get the full request URI, composed by `getBaseRequestURI()` and `getRequestPath()`, including any (not resolved) template parameter.
    `Map<String,Object>` | `getTemplateParameters()` Get the URI template parameters to resolve
    `R` | `header(String name, String... values)` Add a request header.
    `R` | `path(String path)` Append given `path` to the request URI.
    `<P extends Property> R` | `propertySet(Iterable<P> properties)` Use given `Property` set to perform invocation.
    `<P extends Property> R` | `propertySet(P... properties)` Use given `Property` set to perform invocation.
    `R` | `queryParameter(String name, Object... values)` Add a query parameter to the request URI.
    `R` | `resolve(Map<String,Object> nameAndValues)` Resolve one or more a URI templates in the request URI using supplied name-value pairs.
    `R` | `resolve(String name, Object value)` Resolve a URI template with given `name` in the request URI using a supplied value.
    `default R` | `target(String baseUri)` Set request base URI.
    `R` | `target(URI baseUri)` Set request base URI.

- - ### Method Detail

    - #### target

          R target(URI baseUri)

      Set request base URI. URI template parameters are not supported, use `path(String)` to add URI paths to base uri with template parameters support.
      Parameters:
        `baseUri` - Request base URI (not null)
      Returns:
        this

    - #### target

          default R target(String baseUri)

      Set request base URI. URI template parameters are not supported, use `path(String)` to add URI paths to base uri with template parameters support.
      Parameters:
        `baseUri` - Request base URI (not null)
      Returns:
        this

    - #### path

          R path(String path)

      Append given `path` to the request URI.

      May contain URI template parameters, resolved using the values supplied by `resolve(String, Object)` methods.

      A '/' separator will be inserted between the existing path and the supplied path if necessary.

      Parameters:
        `path` - The path to append, may contain URI template parameters
      Returns:
        this

    - #### queryParameter

          R queryParameter(String name,
                           Object... values)

      Add a query parameter to the request URI. If multiple values are supplied the parameter will be added once per value.
      Parameters:
        `name` - Query parameter name (not null)
        `values` - Query parameter value(s)
      Returns:
        this
      Throws:
        `IllegalArgumentException` - If the supplied query parameter name is `null`

    - #### resolve

          R resolve(String name,
                    Object value)

      Resolve a URI template with given `name` in the request URI using a supplied value.
      Parameters:
        `name` - Name of the URI template (not null)
        `value` - Value to be used to resolve the template (not null)
      Returns:
        this
      Throws:
        `IllegalArgumentException` - If the supplied name or value is `null`

    - #### resolve

          R resolve(Map<String,Object> nameAndValues)

      Resolve one or more a URI templates in the request URI using supplied name-value pairs.
      Parameters:
        `nameAndValues` - A map of URI template names and their values
      Returns:
        this
      Throws:
        `IllegalArgumentException` - If the name-value map or any of the names or values in the map is `null`

    - #### accept

          R accept(String... mediaTypes)

      Set the accepted response media types. Any previous value will be replaced.

      A `HttpHeaders.ACCEPT` header will be added to request with given values.

      Parameters:
        `mediaTypes` - Accepted response media types
      Returns:
        this

    - #### accept

          R accept(MediaType... mediaTypes)

      Set the accepted response media types using `MediaType` enumeration. Any previous value will be replaced.

      A `HttpHeaders.ACCEPT` header will be added to request with given values.

      Parameters:
        `mediaTypes` - Accepted response media types.
      Returns:
        this

    - #### acceptLanguage

          R acceptLanguage(Locale... locales)

      Set the acceptable languages. Any previous value will be replaced.

      A `HttpHeaders.ACCEPT_LANGUAGE` header will be added to request with given values.

      Parameters:
        `locales` - Acceptable languages `Locale`
      Returns:
        this

    - #### acceptLanguage

          R acceptLanguage(String... locales)

      Set the acceptable languages. Any previous value will be replaced.

      A `HttpHeaders.ACCEPT_LANGUAGE` header will be added to request with given values.

      Parameters:
        `locales` - Acceptable languages
      Returns:
        this

    - #### acceptEncoding

          R acceptEncoding(String... encodings)

      Set the acceptable encodings. Any previous value will be replaced.

      A `HttpHeaders.ACCEPT_ENCODING` header will be added to request with given values.

      Parameters:
        `encodings` - Acceptable encodings
      Returns:
        this

    - #### acceptCharset

          R acceptCharset(String... charsets)

      Set the acceptable charsets. Any previous value will be replaced.

      A `HttpHeaders.ACCEPT_CHARSET` header will be added to request with given values.

      Parameters:
        `charsets` - Acceptable charsets
      Returns:
        this

    - #### acceptCharset

          R acceptCharset(Charset... charsets)

      Set the acceptable charsets. Any previous value will be replaced.

      A `HttpHeaders.ACCEPT_CHARSET` header will be added to request with given values.

      Parameters:
        `charsets` - Acceptable charsets
      Returns:
        this

    - #### cacheControl

          R cacheControl(CacheControl cacheControl)

      Set the Cache-Control header. Any previous value will be replaced.
      Parameters:
        `cacheControl` - the cache control directives
      Returns:
        this

    - #### authorizationBearer

          R authorizationBearer(String bearerToken)

      Add an `HttpHeaders.AUTHORIZATION` header to request with scheme `HttpHeaders.SCHEME_BEARER` using given bearer token.
      Parameters:
        `bearerToken` - Bearer token to set in authorization header (not null)
      Returns:
        this

    - #### authorizationBasic

          R authorizationBasic(String username,
                               String password)

      Add an `HttpHeaders.AUTHORIZATION` header to request with scheme `HttpHeaders.SCHEME_BASIC` using given username and password.
      Parameters:
        `username` - Username (not null)
        `password` - Password (not null)
      Returns:
        this

    - #### header

          R header(String name,
                   String... values)

      Add a request header. If an header with the same `name` is already defined, it will be replaced by the new value.
      Parameters:
        `name` - Name of the header
        `values` - Value of the header. If multiple values are supplied, the actual header value will be composed by the given values in the specified order separated by a `,`
      Returns:
        this

    - #### propertySet

          <P extends Property> R propertySet(Iterable<P> properties)

      Use given `Property` set to perform invocation. Can be used for `PropertyBox` deserialization when expected response payload contains serialized `PropertyBox` data.
      Type Parameters:
        `P` - Actual property type
      Parameters:
        `properties` - Property set to use (not null)
      Returns:
        this

    - #### propertySet

          <P extends Property> R propertySet(P... properties)

      Use given `Property` set to perform invocation. Can be used for `PropertyBox` deserialization when expected response payload contains serialized `PropertyBox` data.
      Type Parameters:
        `P` - Actual property type
      Parameters:
        `properties` - Property set to use (not null)
      Returns:
        this

    - #### getBaseRequestURI

          Optional<URI> getBaseRequestURI()

      Get the request base URI
      Returns:
        Request base URI

    - #### getRequestPath

          Optional<String> getRequestPath()

      Get the request path to append to the base URI. May contain template parameters.
      Returns:
        Request path

    - #### getRequestURI

          String getRequestURI()

      Get the full request URI, composed by `getBaseRequestURI()` and `getRequestPath()`, including any (not resolved) template parameter.
      Returns:
        Full request URI

    - #### getTemplateParameters

          Map<String,Object> getTemplateParameters()

      Get the URI template parameters to resolve
      Returns:
        URI template parameters name-value map, an empty map if none

    - #### getQueryParameters

          Map<String,Object[]> getQueryParameters()

      Get the URI query parameters
      Returns:
        URI query parameters name-(multi)value map, an empty map if none

    - #### getHeaders

          Map<String,String> getHeaders()

      Get the request headers
      Returns:
        Request headers name-value map, an empty map if none

    - #### getPropertySet

          Optional<PropertySet<?>> getPropertySet()

      Get the `PropertySet` to use to deserialize any `PropertyBox` contained in the response payload
      Returns:
        Optional PropertySet

Copyright © 2019 The Holon Platform. All rights reserved.