Package org.jboss.resteasy.client.jaxrs.engines

## Class URLConnectionEngine

- java.lang.Object
- - org.jboss.resteasy.client.jaxrs.engines.URLConnectionEngine

- All Implemented Interfaces:
    `ClientHttpEngine`

      public class URLConnectionEngine
      extends Object
      implements ClientHttpEngine

  Version:
    $Revision: 1 $
  Author:
    Alexey Ogarkov

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected Integer` | `connectTimeout` |
    `protected boolean` | `followRedirects` |
    `protected HostnameVerifier` | `hostnameVerifier` |
    `protected String` | `proxyHost` |
    `protected Integer` | `proxyPort` |
    `protected String` | `proxyScheme` |
    `protected Integer` | `readTimeout` |
    `protected SSLContext` | `sslContext` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `URLConnectionEngine()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `close()` |
    `protected void` | `commitHeaders​(ClientInvocation request, HttpURLConnection connection)` | Add headers to HttpURLConnection from ClientInvocation.
    `protected HttpURLConnection` | `createConnection​(ClientInvocation request)` | Create HttpUrlConnection from ClientInvorcation and set request method.
    `protected void` | `executeRequest​(ClientInvocation request, HttpURLConnection connection)` | Execute request using HttpURLConnection with body from invocation if needed.
    `protected javax.ws.rs.core.MultivaluedMap<String,​String>` | `getHeaders​(HttpURLConnection connection)` | Create map with response headers.
    `HostnameVerifier` | `getHostnameVerifier()` | {inheritDoc}
    `SSLContext` | `getSslContext()` | {inheritDoc}
    `javax.ws.rs.core.Response` | `invoke​(javax.ws.rs.client.Invocation inv)`
    `boolean` | `isFollowRedirects()` |
    `void` | `setConnectTimeout​(Integer connectTimeout)` |
    `void` | `setFollowRedirects​(boolean followRedirects)` |
    `void` | `setHostnameVerifier​(HostnameVerifier hostnameVerifier)` |
    `void` | `setProxyHost​(String proxyHost)` |
    `void` | `setProxyPort​(Integer proxyPort)` |
    `void` | `setProxyScheme​(String proxyScheme)` |
    `void` | `setReadTimeout​(Integer readTimeout)` |
    `void` | `setSslContext​(SSLContext sslContext)` |

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

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

- - ### Field Detail

    - #### sslContext

          protected SSLContext sslContext

    - #### hostnameVerifier

          protected HostnameVerifier hostnameVerifier

    - #### readTimeout

          protected Integer readTimeout

    - #### connectTimeout

          protected Integer connectTimeout

    - #### proxyHost

          protected String proxyHost

    - #### proxyPort

          protected Integer proxyPort

    - #### proxyScheme

          protected String proxyScheme

    - #### followRedirects

          protected boolean followRedirects

  - ### Constructor Detail

    - #### URLConnectionEngine

          public URLConnectionEngine()

  - ### Method Detail

    - #### invoke

          public javax.ws.rs.core.Response invoke​(javax.ws.rs.client.Invocation inv)

      Specified by:
        `invoke` in interface `ClientHttpEngine`

    - #### getHeaders

          protected javax.ws.rs.core.MultivaluedMap<String,​String> getHeaders​(HttpURLConnection connection)

      Create map with response headers.
      Parameters:
        `connection` - - HttpURLConnection
      Returns:
        map key - list of values

    - #### close

          public void close()

      Specified by:
        `close` in interface `ClientHttpEngine`

    - #### createConnection

          protected HttpURLConnection createConnection​(ClientInvocation request)
                                                throws IOException

      Create HttpUrlConnection from ClientInvorcation and set request method.
      Parameters:
        `request` - ClientInvocation
      Returns:
        HttpURLConnection with method & url already set
      Throws:
        `IOException` - if url or io exceptions

    - #### executeRequest

          protected void executeRequest​(ClientInvocation request,
                                        HttpURLConnection connection)

      Execute request using HttpURLConnection with body from invocation if needed.
      Parameters:
        `request` - ClientInvocation
        `connection` - HttpURLConnection

    - #### commitHeaders

          protected void commitHeaders​(ClientInvocation request,
                                       HttpURLConnection connection)

      Add headers to HttpURLConnection from ClientInvocation. Should be executed before writing body.
      Parameters:
        `request` - ClientInvocation
        `connection` - HttpURLConnection

    - #### getSslContext

          public SSLContext getSslContext()

      {inheritDoc}
      Specified by:
        `getSslContext` in interface `ClientHttpEngine`
      Returns:
        `SSLContext`

    - #### getHostnameVerifier

          public HostnameVerifier getHostnameVerifier()

      {inheritDoc}
      Specified by:
        `getHostnameVerifier` in interface `ClientHttpEngine`
      Returns:
        `HostnameVerifier`

    - #### setSslContext

          public void setSslContext​(SSLContext sslContext)

    - #### setHostnameVerifier

          public void setHostnameVerifier​(HostnameVerifier hostnameVerifier)

    - #### setConnectTimeout

          public void setConnectTimeout​(Integer connectTimeout)

    - #### setReadTimeout

          public void setReadTimeout​(Integer readTimeout)

    - #### setProxyHost

          public void setProxyHost​(String proxyHost)

    - #### setProxyPort

          public void setProxyPort​(Integer proxyPort)

    - #### setProxyScheme

          public void setProxyScheme​(String proxyScheme)

    - #### setFollowRedirects

          public void setFollowRedirects​(boolean followRedirects)

      Specified by:
        `setFollowRedirects` in interface `ClientHttpEngine`

    - #### isFollowRedirects

          public boolean isFollowRedirects()

      Specified by:
        `isFollowRedirects` in interface `ClientHttpEngine`