org.jboss.resteasy.client.jaxrs.internal

## Class ClientInvocationBuilder

- java.lang.Object
- - org.jboss.resteasy.client.jaxrs.internal.ClientInvocationBuilder

- All Implemented Interfaces:
    Invocation.Builder, SyncInvoker

      public class ClientInvocationBuilder
      extends Object
      implements Invocation.Builder

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ClientInvocation` | `invocation`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientInvocationBuilder(ResteasyClient client, URI uri, ClientConfiguration configuration)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Invocation.Builder` | `accept(MediaType... mediaTypes)` Add the accepted response media types.
    `Invocation.Builder` | `accept(String... mediaTypes)` Add the accepted response media types.
    `Invocation.Builder` | `acceptEncoding(String... encodings)` Add acceptable encodings.
    `Invocation.Builder` | `acceptLanguage(Locale... locales)` Add acceptable languages.
    `Invocation.Builder` | `acceptLanguage(String... locales)` Add acceptable languages.
    `AsyncInvoker` | `async()` Access the asynchronous uniform request invocation interface to asynchronously invoke the built request.
    `Invocation` | `build(String method)` Build a request invocation using an arbitrary request method name.
    `Invocation` | `build(String method, Entity<?> entity)` Build a request invocation using an arbitrary request method name and request entity.
    `Invocation` | `buildDelete()` Build a DELETE request invocation.
    `Invocation` | `buildGet()` Build a GET request invocation.
    `Invocation` | `buildPost(Entity<?> entity)` Build a POST request invocation.
    `Invocation` | `buildPut(Entity<?> entity)` Build a PUT request invocation.
    `Invocation.Builder` | `cacheControl(CacheControl cacheControl)` Set the cache control data of the message.
    `Invocation.Builder` | `cookie(Cookie cookie)` Add a cookie to be set.
    `Invocation.Builder` | `cookie(String name, String value)` Add a cookie to be set.
    `Response` | `delete()` Invoke HTTP DELETE method for the current request synchronously.
    `<T> T` | `delete(Class<T> responseType)` Invoke HTTP DELETE method for the current request synchronously.
    `<T> T` | `delete(GenericType<T> responseType)` Invoke HTTP DELETE method for the current request synchronously.
    `Response` | `get()` Invoke HTTP GET method for the current request synchronously.
    `<T> T` | `get(Class<T> responseType)` Invoke HTTP GET method for the current request synchronously.
    `<T> T` | `get(GenericType<T> responseType)` Invoke HTTP GET method for the current request synchronously.
    `ClientRequestHeaders` | `getHeaders()`
    `ClientInvocation` | `getInvocation()`
    `Response` | `head()` Invoke HTTP HEAD method for the current request synchronously.
    `Invocation.Builder` | `header(String name, Object value)` Add an arbitrary header.
    `Invocation.Builder` | `headers(MultivaluedMap<String,Object> headers)` Replaces all existing headers with the newly supplied headers.
    `Response` | `method(String name)` Invoke an arbitrary method for the current request synchronously.
    `<T> T` | `method(String name, Class<T> responseType)` Invoke an arbitrary method for the current request synchronously.
    `Response` | `method(String name, Entity<?> entity)` Invoke an arbitrary method for the current request synchronously.
    `<T> T` | `method(String name, Entity<?> entity, Class<T> responseType)` Invoke an arbitrary method for the current request synchronously.
    `<T> T` | `method(String name, Entity<?> entity, GenericType<T> responseType)` Invoke an arbitrary method for the current request synchronously.
    `<T> T` | `method(String name, GenericType<T> responseType)` Invoke an arbitrary method for the current request synchronously.
    `Response` | `options()` Invoke HTTP OPTIONS method for the current request synchronously.
    `<T> T` | `options(Class<T> responseType)` Invoke HTTP OPTIONS method for the current request synchronously.
    `<T> T` | `options(GenericType<T> responseType)` Invoke HTTP OPTIONS method for the current request synchronously.
    `Response` | `post(Entity<?> entity)` Invoke HTTP POST method for the current request synchronously.
    `<T> T` | `post(Entity<?> entity, Class<T> responseType)` Invoke HTTP POST method for the current request synchronously.
    `<T> T` | `post(Entity<?> entity, GenericType<T> responseType)` Invoke HTTP POST method for the current request synchronously.
    `Invocation.Builder` | `property(String name, Object value)` Set a new property in the context of a request represented by this invocation builder.
    `Response` | `put(Entity<?> entity)` Invoke HTTP PUT method for the current request synchronously.
    `<T> T` | `put(Entity<?> entity, Class<T> responseType)` Invoke HTTP PUT method for the current request synchronously.
    `<T> T` | `put(Entity<?> entity, GenericType<T> responseType)` Invoke HTTP PUT method for the current request synchronously.
    `Response` | `trace()` Invoke HTTP TRACE method for the current request synchronously.
    `<T> T` | `trace(Class<T> responseType)` Invoke HTTP TRACE method for the current request synchronously.
    `<T> T` | `trace(GenericType<T> responseType)` Invoke HTTP TRACE method for the current request synchronously.

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

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

- - ### Field Detail

    - #### invocation

          protected ClientInvocation invocation

  - ### Constructor Detail

    - #### ClientInvocationBuilder

          public ClientInvocationBuilder(ResteasyClient client,
                                 URI uri,
                                 ClientConfiguration configuration)

  - ### Method Detail

    - #### getInvocation

          public ClientInvocation getInvocation()

    - #### getHeaders

          public ClientRequestHeaders getHeaders()

    - #### accept

          public Invocation.Builder accept(String... mediaTypes)

      Description copied from interface: `Invocation.Builder`
      Add the accepted response media types.
      Specified by:
        `accept` in interface `Invocation.Builder`
      Parameters:
        `mediaTypes` - accepted response media types.
      Returns:
        the updated builder.

    - #### accept

          public Invocation.Builder accept(MediaType... mediaTypes)

      Description copied from interface: `Invocation.Builder`
      Add the accepted response media types.
      Specified by:
        `accept` in interface `Invocation.Builder`
      Parameters:
        `mediaTypes` - accepted response media types.
      Returns:
        the updated builder.

    - #### acceptLanguage

          public Invocation.Builder acceptLanguage(Locale... locales)

      Description copied from interface: `Invocation.Builder`
      Add acceptable languages.
      Specified by:
        `acceptLanguage` in interface `Invocation.Builder`
      Parameters:
        `locales` - an array of the acceptable languages.
      Returns:
        the updated builder.

    - #### acceptLanguage

          public Invocation.Builder acceptLanguage(String... locales)

      Description copied from interface: `Invocation.Builder`
      Add acceptable languages.
      Specified by:
        `acceptLanguage` in interface `Invocation.Builder`
      Parameters:
        `locales` - an array of the acceptable languages.
      Returns:
        the updated builder.

    - #### acceptEncoding

          public Invocation.Builder acceptEncoding(String... encodings)

      Description copied from interface: `Invocation.Builder`
      Add acceptable encodings.
      Specified by:
        `acceptEncoding` in interface `Invocation.Builder`
      Parameters:
        `encodings` - an array of the acceptable encodings.
      Returns:
        the updated builder.

    - #### cookie

          public Invocation.Builder cookie(Cookie cookie)

      Description copied from interface: `Invocation.Builder`
      Add a cookie to be set.
      Specified by:
        `cookie` in interface `Invocation.Builder`
      Parameters:
        `cookie` - to be set.
      Returns:
        the updated builder.

    - #### cookie

          public Invocation.Builder cookie(String name,
                                  String value)

      Description copied from interface: `Invocation.Builder`
      Add a cookie to be set.
      Specified by:
        `cookie` in interface `Invocation.Builder`
      Parameters:
        `name` - the name of the cookie.
        `value` - the value of the cookie.
      Returns:
        the updated builder.

    - #### cacheControl

          public Invocation.Builder cacheControl(CacheControl cacheControl)

      Description copied from interface: `Invocation.Builder`
      Set the cache control data of the message.
      Specified by:
        `cacheControl` in interface `Invocation.Builder`
      Parameters:
        `cacheControl` - the cache control directives, if `null` any existing cache control directives will be removed.
      Returns:
        the updated builder.

    - #### header

          public Invocation.Builder header(String name,
                                  Object value)

      Description copied from interface: `Invocation.Builder`
      Add an arbitrary header.
      Specified by:
        `header` in interface `Invocation.Builder`
      Parameters:
        `name` - the name of the header
        `value` - the value of the header, the header will be serialized using a `RuntimeDelegate.HeaderDelegate` if one is available via `RuntimeDelegate.createHeaderDelegate(java.lang.Class)` for the class of `value` or using its `toString` method if a header delegate is not available. If `value` is `null` then all current headers of the same name will be removed.
      Returns:
        the updated builder.

    - #### headers

          public Invocation.Builder headers(MultivaluedMap<String,Object> headers)

      Description copied from interface: `Invocation.Builder`
      Replaces all existing headers with the newly supplied headers.
      Specified by:
        `headers` in interface `Invocation.Builder`
      Parameters:
        `headers` - new headers to be set, if `null` all existing headers will be removed.
      Returns:
        the updated builder.

    - #### build

          public Invocation build(String method)

      Description copied from interface: `Invocation.Builder`
      Build a request invocation using an arbitrary request method name.
      Specified by:
        `build` in interface `Invocation.Builder`
      Parameters:
        `method` - request method name.
      Returns:
        invocation encapsulating the built request.

    - #### build

          public Invocation build(String method,
                         Entity<?> entity)

      Description copied from interface: `Invocation.Builder`
      Build a request invocation using an arbitrary request method name and request entity.
      Specified by:
        `build` in interface `Invocation.Builder`
      Parameters:
        `method` - request method name.
        `entity` - request entity, including it's full `Variant` information. Any variant-related HTTP headers previously set (namely `Content-Type`, `Content-Language` and `Content-Encoding`) will be overwritten using the entity variant information.
      Returns:
        invocation encapsulating the built request.

    - #### buildGet

          public Invocation buildGet()

      Description copied from interface: `Invocation.Builder`
      Build a GET request invocation.
      Specified by:
        `buildGet` in interface `Invocation.Builder`
      Returns:
        invocation encapsulating the built GET request.

    - #### buildDelete

          public Invocation buildDelete()

      Description copied from interface: `Invocation.Builder`
      Build a DELETE request invocation.
      Specified by:
        `buildDelete` in interface `Invocation.Builder`
      Returns:
        invocation encapsulating the built DELETE request.

    - #### buildPost

          public Invocation buildPost(Entity<?> entity)

      Description copied from interface: `Invocation.Builder`
      Build a POST request invocation.
      Specified by:
        `buildPost` in interface `Invocation.Builder`
      Parameters:
        `entity` - request entity, including it's full `Variant` information. Any variant-related HTTP headers previously set (namely `Content-Type`, `Content-Language` and `Content-Encoding`) will be overwritten using the entity variant information.
      Returns:
        invocation encapsulating the built POST request.

    - #### buildPut

          public Invocation buildPut(Entity<?> entity)

      Description copied from interface: `Invocation.Builder`
      Build a PUT request invocation.
      Specified by:
        `buildPut` in interface `Invocation.Builder`
      Parameters:
        `entity` - request entity, including it's full `Variant` information. Any variant-related HTTP headers previously set (namely `Content-Type`, `Content-Language` and `Content-Encoding`) will be overwritten using the entity variant information.
      Returns:
        invocation encapsulating the built PUT request.

    - #### async

          public AsyncInvoker async()

      Description copied from interface: `Invocation.Builder`
      Access the asynchronous uniform request invocation interface to asynchronously invoke the built request.
      Specified by:
        `async` in interface `Invocation.Builder`
      Returns:
        asynchronous uniform request invocation interface.

    - #### get

          public Response get()

      Description copied from interface: `SyncInvoker`
      Invoke HTTP GET method for the current request synchronously.
      Specified by:
        `get` in interface `SyncInvoker`
      Returns:
        invocation response.

    - #### get

          public <T> T get(Class<T> responseType)

      Description copied from interface: `SyncInvoker`
      Invoke HTTP GET method for the current request synchronously.
      Specified by:
        `get` in interface `SyncInvoker`
      Type Parameters:
        `T` - response entity type.
      Parameters:
        `responseType` - Java type the response entity will be converted to.
      Returns:
        invocation response.

    - #### get

          public <T> T get(GenericType<T> responseType)

      Description copied from interface: `SyncInvoker`
      Invoke HTTP GET method for the current request synchronously.
      Specified by:
        `get` in interface `SyncInvoker`
      Type Parameters:
        `T` - generic response entity type.
      Parameters:
        `responseType` - representation of a generic Java type the response entity will be converted to.
      Returns:
        invocation response.

    - #### put

          public Response put(Entity<?> entity)

      Description copied from interface: `SyncInvoker`
      Invoke HTTP PUT method for the current request synchronously.
      Specified by:
        `put` in interface `SyncInvoker`
      Parameters:
        `entity` - request entity, including it's full `Variant` information. Any variant-related HTTP headers previously set (namely `Content-Type`, `Content-Language` and `Content-Encoding`) will be overwritten using the entity variant information.
      Returns:
        invocation response.

    - #### put

          public <T> T put(Entity<?> entity,
                  Class<T> responseType)

      Description copied from interface: `SyncInvoker`
      Invoke HTTP PUT method for the current request synchronously.
      Specified by:
        `put` in interface `SyncInvoker`
      Type Parameters:
        `T` - response entity type.
      Parameters:
        `entity` - request entity, including it's full `Variant` information. Any variant-related HTTP headers previously set (namely `Content-Type`, `Content-Language` and `Content-Encoding`) will be overwritten using the entity variant information.
        `responseType` - Java type the response entity will be converted to.
      Returns:
        invocation response.

    - #### put

          public <T> T put(Entity<?> entity,
                  GenericType<T> responseType)

      Description copied from interface: `SyncInvoker`
      Invoke HTTP PUT method for the current request synchronously.
      Specified by:
        `put` in interface `SyncInvoker`
      Type Parameters:
        `T` - generic response entity type.
      Parameters:
        `entity` - request entity, including it's full `Variant` information. Any variant-related HTTP headers previously set (namely `Content-Type`, `Content-Language` and `Content-Encoding`) will be overwritten using the entity variant information.
        `responseType` - representation of a generic Java type the response entity will be converted to.
      Returns:
        invocation response.

    - #### post

          public Response post(Entity<?> entity)

      Description copied from interface: `SyncInvoker`
      Invoke HTTP POST method for the current request synchronously.
      Specified by:
        `post` in interface `SyncInvoker`
      Parameters:
        `entity` - request entity, including it's full `Variant` information. Any variant-related HTTP headers previously set (namely `Content-Type`, `Content-Language` and `Content-Encoding`) will be overwritten using the entity variant information.
      Returns:
        invocation response.

    - #### post

          public <T> T post(Entity<?> entity,
                   Class<T> responseType)

      Description copied from interface: `SyncInvoker`
      Invoke HTTP POST method for the current request synchronously.
      Specified by:
        `post` in interface `SyncInvoker`
      Type Parameters:
        `T` - response entity type.
      Parameters:
        `entity` - request entity, including it's full `Variant` information. Any variant-related HTTP headers previously set (namely `Content-Type`, `Content-Language` and `Content-Encoding`) will be overwritten using the entity variant information.
        `responseType` - Java type the response entity will be converted to.
      Returns:
        invocation response.

    - #### post

          public <T> T post(Entity<?> entity,
                   GenericType<T> responseType)

      Description copied from interface: `SyncInvoker`
      Invoke HTTP POST method for the current request synchronously.
      Specified by:
        `post` in interface `SyncInvoker`
      Type Parameters:
        `T` - generic response entity type.
      Parameters:
        `entity` - request entity, including it's full `Variant` information. Any variant-related HTTP headers previously set (namely `Content-Type`, `Content-Language` and `Content-Encoding`) will be overwritten using the entity variant information.
        `responseType` - representation of a generic Java type the response entity will be converted to.
      Returns:
        invocation response.

    - #### delete

          public Response delete()

      Description copied from interface: `SyncInvoker`
      Invoke HTTP DELETE method for the current request synchronously.
      Specified by:
        `delete` in interface `SyncInvoker`
      Returns:
        invocation response.

    - #### delete

          public <T> T delete(Class<T> responseType)

      Description copied from interface: `SyncInvoker`
      Invoke HTTP DELETE method for the current request synchronously.
      Specified by:
        `delete` in interface `SyncInvoker`
      Type Parameters:
        `T` - response entity type.
      Parameters:
        `responseType` - Java type the response entity will be converted to.
      Returns:
        invocation response.

    - #### delete

          public <T> T delete(GenericType<T> responseType)

      Description copied from interface: `SyncInvoker`
      Invoke HTTP DELETE method for the current request synchronously.
      Specified by:
        `delete` in interface `SyncInvoker`
      Type Parameters:
        `T` - generic response entity type.
      Parameters:
        `responseType` - representation of a generic Java type the response entity will be converted to.
      Returns:
        invocation response.

    - #### head

          public Response head()

      Description copied from interface: `SyncInvoker`
      Invoke HTTP HEAD method for the current request synchronously.
      Specified by:
        `head` in interface `SyncInvoker`
      Returns:
        invocation response.

    - #### options

          public Response options()

      Description copied from interface: `SyncInvoker`
      Invoke HTTP OPTIONS method for the current request synchronously.
      Specified by:
        `options` in interface `SyncInvoker`
      Returns:
        invocation response.

    - #### options

          public <T> T options(Class<T> responseType)

      Description copied from interface: `SyncInvoker`
      Invoke HTTP OPTIONS method for the current request synchronously.
      Specified by:
        `options` in interface `SyncInvoker`
      Type Parameters:
        `T` - response entity type.
      Parameters:
        `responseType` - Java type the response entity will be converted to.
      Returns:
        invocation response.

    - #### options

          public <T> T options(GenericType<T> responseType)

      Description copied from interface: `SyncInvoker`
      Invoke HTTP OPTIONS method for the current request synchronously.
      Specified by:
        `options` in interface `SyncInvoker`
      Type Parameters:
        `T` - generic response entity type.
      Parameters:
        `responseType` - representation of a generic Java type the response entity will be converted to.
      Returns:
        invocation response.

    - #### trace

          public Response trace()

      Description copied from interface: `SyncInvoker`
      Invoke HTTP TRACE method for the current request synchronously.
      Specified by:
        `trace` in interface `SyncInvoker`
      Returns:
        invocation response.

    - #### trace

          public <T> T trace(Class<T> responseType)

      Description copied from interface: `SyncInvoker`
      Invoke HTTP TRACE method for the current request synchronously.
      Specified by:
        `trace` in interface `SyncInvoker`
      Type Parameters:
        `T` - response entity type.
      Parameters:
        `responseType` - Java type the response entity will be converted to.
      Returns:
        invocation response.

    - #### trace

          public <T> T trace(GenericType<T> responseType)

      Description copied from interface: `SyncInvoker`
      Invoke HTTP TRACE method for the current request synchronously.
      Specified by:
        `trace` in interface `SyncInvoker`
      Type Parameters:
        `T` - generic response entity type.
      Parameters:
        `responseType` - representation of a generic Java type the response entity will be converted to.
      Returns:
        invocation response.

    - #### method

          public Response method(String name)

      Description copied from interface: `SyncInvoker`
      Invoke an arbitrary method for the current request synchronously.
      Specified by:
        `method` in interface `SyncInvoker`
      Parameters:
        `name` - method name.
      Returns:
        invocation response.

    - #### method

          public <T> T method(String name,
                     Class<T> responseType)

      Description copied from interface: `SyncInvoker`
      Invoke an arbitrary method for the current request synchronously.
      Specified by:
        `method` in interface `SyncInvoker`
      Type Parameters:
        `T` - response entity type.
      Parameters:
        `name` - method name.
        `responseType` - Java type the response entity will be converted to.
      Returns:
        invocation response.

    - #### method

          public <T> T method(String name,
                     GenericType<T> responseType)

      Description copied from interface: `SyncInvoker`
      Invoke an arbitrary method for the current request synchronously.
      Specified by:
        `method` in interface `SyncInvoker`
      Type Parameters:
        `T` - generic response entity type.
      Parameters:
        `name` - method name.
        `responseType` - representation of a generic Java type the response entity will be converted to.
      Returns:
        invocation response.

    - #### method

          public Response method(String name,
                        Entity<?> entity)

      Description copied from interface: `SyncInvoker`
      Invoke an arbitrary method for the current request synchronously.
      Specified by:
        `method` in interface `SyncInvoker`
      Parameters:
        `name` - method name.
        `entity` - request entity, including it's full `Variant` information. Any variant-related HTTP headers previously set (namely `Content-Type`, `Content-Language` and `Content-Encoding`) will be overwritten using the entity variant information.
      Returns:
        invocation response.

    - #### method

          public <T> T method(String name,
                     Entity<?> entity,
                     Class<T> responseType)

      Description copied from interface: `SyncInvoker`
      Invoke an arbitrary method for the current request synchronously.
      Specified by:
        `method` in interface `SyncInvoker`
      Type Parameters:
        `T` - response entity type.
      Parameters:
        `name` - method name.
        `entity` - request entity, including it's full `Variant` information. Any variant-related HTTP headers previously set (namely `Content-Type`, `Content-Language` and `Content-Encoding`) will be overwritten using the entity variant information.
        `responseType` - Java type the response entity will be converted to.
      Returns:
        invocation response.

    - #### method

          public <T> T method(String name,
                     Entity<?> entity,
                     GenericType<T> responseType)

      Description copied from interface: `SyncInvoker`
      Invoke an arbitrary method for the current request synchronously.
      Specified by:
        `method` in interface `SyncInvoker`
      Type Parameters:
        `T` - generic response entity type.
      Parameters:
        `name` - method name.
        `entity` - request entity, including it's full `Variant` information. Any variant-related HTTP headers previously set (namely `Content-Type`, `Content-Language` and `Content-Encoding`) will be overwritten using the entity variant information.
        `responseType` - representation of a generic Java type the response entity will be converted to.
      Returns:
        invocation response.

    - #### property

          public Invocation.Builder property(String name,
                                    Object value)

      Description copied from interface: `Invocation.Builder`
      Set a new property in the context of a request represented by this invocation builder.

      The property is available for a later retrieval via `ClientRequestContext.getProperty(String)` or `InterceptorContext.getProperty(String)`. If a property with a given name is already set in the request context, the existing value of the property will be updated. Setting a `null` value into a property effectively removes the property from the request property bag.

      Specified by:
        `property` in interface `Invocation.Builder`
      Parameters:
        `name` - property name.
        `value` - (new) property value. `null` value removes the property with the given name.
      Returns:
        the updated builder.
      See Also:
        `Invocation.property(String, Object)`

Copyright © 2014. All Rights Reserved.