com.holonplatform.http.rest

## Interface RestClient.RequestDefinition

- All Superinterfaces:
    RestClient.Invocation, Serializable
  Enclosing interface:
    RestClient

      public static interface RestClient.RequestDefinition
      extends RestClient.Invocation, Serializable

  Request message definition and response invocation.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `RestClient.RequestDefinition` | `accept(MediaType... mediaTypes)` Set the accepted response media types using `MediaType` enumeration.
    `RestClient.RequestDefinition` | `accept(String... mediaTypes)` Set the accepted response media types.
    `RestClient.RequestDefinition` | `acceptCharset(Charset... charsets)` Set the acceptable charsets.
    `RestClient.RequestDefinition` | `acceptCharset(String... charsets)` Set the acceptable charsets.
    `RestClient.RequestDefinition` | `acceptEncoding(String... encodings)` Set the acceptable encodings.
    `RestClient.RequestDefinition` | `acceptLanguage(Locale... locales)` Set the acceptable languages.
    `RestClient.RequestDefinition` | `acceptLanguage(String... locales)` Set the acceptable languages.
    `RestClient.RequestDefinition` | `authorizationBasic(String username, String password)` Add an `HttpHeaders.AUTHORIZATION` header to request with scheme `HttpHeaders.SCHEME_BASIC` using given username and password.
    `RestClient.RequestDefinition` | `authorizationBearer(String bearerToken)` Add an `HttpHeaders.AUTHORIZATION` header to request with scheme `HttpHeaders.SCHEME_BEARER` using given bearer token.
    `RestClient.RequestDefinition` | `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
    `RestClient.RequestDefinition` | `header(String name, String... values)` Add a request header.
    `RestClient.RequestDefinition` | `path(String path)` Append given `path` to the request URI.
    `<P extends Property> RestClient.RequestDefinition` | `propertySet(Iterable<P> properties)` Use given `Property` set to perform invocation.
    `<P extends Property> RestClient.RequestDefinition` | `propertySet(P... properties)` Use given `Property` set to perform invocation.
    `RestClient.RequestDefinition` | `queryParameter(String name, Object... values)` Add a query parameter to the request URI.
    `RestClient.RequestDefinition` | `resolve(Map<String,Object> nameAndValues)` Resolve one or more a URI templates in the request URI using supplied name-value pairs.
    `RestClient.RequestDefinition` | `resolve(String name, Object value)` Resolve a URI template with given `name` in the request URI using a supplied value.
    `default RestClient.RequestDefinition` | `target(String baseUri)` Set request base URI.
    `RestClient.RequestDefinition` | `target(URI baseUri)` Set request base URI.

    - ### Methods inherited from interface com.holonplatform.http.rest.RestClient.Invocation

      `delete, delete, delete, deleteForEntity, deleteForEntity, deleteOrFail, get, get, getAsList, getForEntity, getForEntity, getForStream, head, invoke, invokeForEntity, invokeForSuccess, 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`

- - ### Method Detail

    - #### target

          RestClient.RequestDefinition 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 RestClient.RequestDefinition 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

          RestClient.RequestDefinition 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

          RestClient.RequestDefinition 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

          RestClient.RequestDefinition 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

          RestClient.RequestDefinition 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

          RestClient.RequestDefinition 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

          RestClient.RequestDefinition 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

          RestClient.RequestDefinition 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

          RestClient.RequestDefinition 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

          RestClient.RequestDefinition 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

          RestClient.RequestDefinition 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

          RestClient.RequestDefinition 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

          RestClient.RequestDefinition cacheControl(CacheControl cacheControl)

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

    - #### authorizationBearer

          RestClient.RequestDefinition 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

          RestClient.RequestDefinition 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

          RestClient.RequestDefinition 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> RestClient.RequestDefinition 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> RestClient.RequestDefinition 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 © 2017 The Holon Platform. All rights reserved.