org.jboss.resteasy.client.core.executors

## Class ApacheHttpClient4Executor

- java.lang.Object
- - org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

- All Implemented Interfaces:
    ClientExecutor

      public class ApacheHttpClient4Executor
      extends Object
      implements ClientExecutor

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `BYTE_MEMORY_UNIT`
    `protected boolean` | `closed`
    `protected boolean` | `createdHttpClient`
    `static String` | `GIGABYTE_MEMORY_UNIT`
    `protected org.apache.http.client.HttpClient` | `httpClient`
    `protected org.apache.http.protocol.HttpContext` | `httpContext`
    `static String` | `KILOBYTE_MEMORY_UNIT`
    `static String` | `MEGABYTE_MEMORY_UNIT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ApacheHttpClient4Executor()`
    `ApacheHttpClient4Executor(org.apache.http.client.HttpClient httpClient)`
    `ApacheHttpClient4Executor(org.apache.http.client.HttpClient httpClient, org.apache.http.protocol.HttpContext httpContext)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected org.apache.http.HttpEntity` | `buildEntity(ClientRequest request)` Build the HttpEntity to be sent to the Service as part of (POST) request.
    `protected void` | `cleanUpAfterExecute(org.apache.http.client.methods.HttpRequestBase httpMethod)` If passed httpMethod is of type HttpPost then obtain its entity.
    `void` | `close()`
    `void` | `commitHeaders(ClientRequest request, org.apache.http.client.methods.HttpRequestBase httpMethod)`
    `ClientRequest` | `createRequest(String uriTemplate)`
    `ClientRequest` | `createRequest(UriBuilder uriBuilder)`
    `ClientResponse` | `execute(ClientRequest request)`
    `static CaseInsensitiveMap<String>` | `extractHeaders(org.apache.http.HttpResponse response)`
    `void` | `finalize()`
    `org.apache.http.client.HttpClient` | `getHttpClient()`
    `org.apache.http.protocol.HttpContext` | `getHttpContext()`
    `protected String` | `getTempfilePrefix()` Use context information, which will include node name, to avoid conflicts in case of multiple VMS using same temp directory location.
    `boolean` | `isClosed()`
    `void` | `loadHttpMethod(ClientRequest request, org.apache.http.client.methods.HttpRequestBase httpMethod)`
    `void` | `setFileUploadInMemoryThresholdLimit(int pInMemoryThresholdLimit)` Setter for `fileUploadInMemoryThresholdLimit`
    `void` | `setFileUploadMemoryUnit(String pMemoryUnit)` Setter for `fileUploadMemoryUnit`
    `void` | `setFileUploadTempFileDir(File pTempFileDir)` Setter for `fileUploadTempFileDir`
    `void` | `setHttpContext(org.apache.http.protocol.HttpContext httpContext)`

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

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

- - ### Field Detail

    - #### BYTE_MEMORY_UNIT

          public static final String BYTE_MEMORY_UNIT

      See Also:
        Constant Field Values

    - #### KILOBYTE_MEMORY_UNIT

          public static final String KILOBYTE_MEMORY_UNIT

      See Also:
        Constant Field Values

    - #### MEGABYTE_MEMORY_UNIT

          public static final String MEGABYTE_MEMORY_UNIT

      See Also:
        Constant Field Values

    - #### GIGABYTE_MEMORY_UNIT

          public static final String GIGABYTE_MEMORY_UNIT

      See Also:
        Constant Field Values

    - #### httpClient

          protected org.apache.http.client.HttpClient httpClient

    - #### createdHttpClient

          protected boolean createdHttpClient

    - #### httpContext

          protected org.apache.http.protocol.HttpContext httpContext

    - #### closed

          protected boolean closed

  - ### Constructor Detail

    - #### ApacheHttpClient4Executor

          public ApacheHttpClient4Executor()

    - #### ApacheHttpClient4Executor

          public ApacheHttpClient4Executor(org.apache.http.client.HttpClient httpClient)

    - #### ApacheHttpClient4Executor

          public ApacheHttpClient4Executor(org.apache.http.client.HttpClient httpClient,
                                   org.apache.http.protocol.HttpContext httpContext)

  - ### Method Detail

    - #### getHttpClient

          public org.apache.http.client.HttpClient getHttpClient()

    - #### getHttpContext

          public org.apache.http.protocol.HttpContext getHttpContext()

    - #### setHttpContext

          public void setHttpContext(org.apache.http.protocol.HttpContext httpContext)

    - #### extractHeaders

          public static CaseInsensitiveMap<String> extractHeaders(org.apache.http.HttpResponse response)

    - #### createRequest

          public ClientRequest createRequest(String uriTemplate)

      Specified by:
        `createRequest` in interface `ClientExecutor`

    - #### createRequest

          public ClientRequest createRequest(UriBuilder uriBuilder)

      Specified by:
        `createRequest` in interface `ClientExecutor`

    - #### execute

          public ClientResponse execute(ClientRequest request)
                                 throws Exception

      Specified by:
        `execute` in interface `ClientExecutor`
      Throws:
        `Exception`

    - #### cleanUpAfterExecute

          protected void cleanUpAfterExecute(org.apache.http.client.methods.HttpRequestBase httpMethod)

      If passed httpMethod is of type HttpPost then obtain its entity. If the entity has an enclosing File then delete it by invoking this method after the request has completed. The entity will have an enclosing File only if it was too huge to fit into memory.
      Parameters:
        `httpMethod` - - the httpMethod to clean up.
      See Also:
        `writeRequestBodyToOutputStream(ClientRequest)`

    - #### loadHttpMethod

          public void loadHttpMethod(ClientRequest request,
                            org.apache.http.client.methods.HttpRequestBase httpMethod)
                              throws Exception

      Throws:
        `Exception`

    - #### buildEntity

          protected org.apache.http.HttpEntity buildEntity(ClientRequest request)
                                                    throws IOException

      Build the HttpEntity to be sent to the Service as part of (POST) request. Creates a off-memory `FileExposingFileEntity` or a regular in-memory `ByteArrayEntity` depending on if the request OutputStream fit into memory when built by calling `writeRequestBodyToOutputStream(ClientRequest)`.
      Parameters:
        `request` - -
      Returns:
        - the built HttpEntity
      Throws:
        `IOException` - -

    - #### getTempfilePrefix

          protected String getTempfilePrefix()

      Use context information, which will include node name, to avoid conflicts in case of multiple VMS using same temp directory location.
      Returns:
        -

    - #### setFileUploadInMemoryThresholdLimit

          public void setFileUploadInMemoryThresholdLimit(int pInMemoryThresholdLimit)

      Setter for `fileUploadInMemoryThresholdLimit`
      Parameters:
        `pInMemoryThresholdLimit` - - the inMemoryThresholdLimitMB to set

    - #### setFileUploadTempFileDir

          public void setFileUploadTempFileDir(File pTempFileDir)

      Setter for `fileUploadTempFileDir`
      Parameters:
        `pTempFileDir` - the tempFileDir to set

    - #### setFileUploadMemoryUnit

          public void setFileUploadMemoryUnit(String pMemoryUnit)

      Setter for `fileUploadMemoryUnit`
      Parameters:
        `pMemoryUnit` - the memoryUnit to set

    - #### commitHeaders

          public void commitHeaders(ClientRequest request,
                           org.apache.http.client.methods.HttpRequestBase httpMethod)

    - #### close

          public void close()

      Specified by:
        `close` in interface `ClientExecutor`

    - #### isClosed

          public boolean isClosed()

    - #### finalize

          public void finalize()
                        throws Throwable

      Overrides:
        `finalize` in class `Object`
      Throws:
        `Throwable`

Copyright © 2014. All Rights Reserved.