public class UrlRequestTransport extends java.lang.Object implements RequestTransport
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.
RequestTransport.TransportReceiver
Constructor and Description |
---|
UrlRequestTransport(java.net.URL url)
Construct a new UrlRequestTransport.
|
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.
|
public UrlRequestTransport(java.net.URL url)
url
- the URL to connect tojava.lang.IllegalArgumentException
- if the url's protocol is not http
or https
public java.util.Map<java.lang.String,java.lang.String> getCookies()
public void send(java.lang.String payload, RequestTransport.TransportReceiver receiver)
RequestTransport
send
in interface RequestTransport
payload
- the String payloadreceiver
- the RequestTransport.TransportReceiver
instance that will receive
the payloadprotected void configureConnection(java.net.HttpURLConnection connection) throws java.io.IOException
java.io.IOException