Class 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.

    • Constructor Summary

      Constructors 
      Constructor Description
      UrlRequestTransport​(java.net.URL url)
      Construct a new UrlRequestTransport.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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.
      • configureConnection

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