com.google.web.bindery.requestfactory.vm.testing

## Class UrlRequestTransport

- java.lang.Object
- - com.google.web.bindery.requestfactory.vm.testing.UrlRequestTransport

- All Implemented Interfaces:
    RequestTransport

      public class UrlRequestTransport
      extends java.lang.Object
      implements RequestTransport

  A trivial implementation of RequestTransport that uses a `HttpURLConnection`. Details of the connection can be amended by overriding `configureConnection(HttpURLConnection)`.

  This implementation only supports `http` and `https` URLs. It has primitive support for recording and playing back cookies, but does not implement expiration processing.

  Developers who wish to build a more production-ready client should consider using a RequestTRansport based around Apache HttpClient instead.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.google.web.bindery.requestfactory.shared.RequestTransport

      `RequestTransport.TransportReceiver`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UrlRequestTransport(java.net.URL url)` Construct a new UrlRequestTransport.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `configureConnection(java.net.HttpURLConnection connection)`
    `java.util.Map<java.lang.String,java.lang.String>` | `getCookies()` Provides access to the cookies that will be sent for subsequent requests.
    `void` | `send(java.lang.String payload, RequestTransport.TransportReceiver receiver)` Called by the RequestFactory implementation.

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

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

- - ### Constructor Detail

    - #### UrlRequestTransport

          public UrlRequestTransport(java.net.URL url)

      Construct a new UrlRequestTransport.
      Parameters:
        `url` - the URL to connect to
      Throws:
        `java.lang.IllegalArgumentException` - if the url's protocol is not `http` or `https`

  - ### Method Detail

    - #### getCookies

          public java.util.Map<java.lang.String,java.lang.String> getCookies()

      Provides access to the cookies that will be sent for subsequent requests.

    - #### send

          public void send(java.lang.String payload,
                           RequestTransport.TransportReceiver receiver)

      Description copied from interface: `RequestTransport`
      Called by the RequestFactory implementation.
      Specified by:
        `send` in interface `RequestTransport`
      Parameters:
        `payload` - the String payload
        `receiver` - the `RequestTransport.TransportReceiver` instance that will receive the payload

    - #### configureConnection

          protected void configureConnection(java.net.HttpURLConnection connection)
                                      throws java.io.IOException

      Throws:
        `java.io.IOException`