public class UrlConnectionHttpHandler extends java.lang.Object implements HttpHandler
HttpHandler using
HttpURLConnection. To use a different HttpURLConnection implementation simply
override the execute(Request)} method.| Constructor and Description |
|---|
UrlConnectionHttpHandler() |
| Modifier and Type | Method and Description |
|---|---|
Response |
execute(Request request)
Sends an HTTP request.
|
protected java.net.HttpURLConnection |
openConnection(Request request)
Opens a connection based on the URL in the given request.
|
protected Response |
readResponse(java.net.HttpURLConnection connection)
Reads a
Response from an existing connection. |
protected void |
sendRequest(java.net.HttpURLConnection connection,
Request request)
Sends a request over a given connection.
|
public Response execute(Request request) throws java.io.IOException
execute in interface HttpHandlerrequest - The Request to send.Response object describing the response from the server.java.io.IOException - If there was an error during the connection.protected java.net.HttpURLConnection openConnection(Request request) throws java.io.IOException
HttpURLConnection.request - The Request.HttpURLConnection.java.io.IOException - If there is an error opening the connection.protected void sendRequest(java.net.HttpURLConnection connection,
Request request)
throws java.io.IOException
connection - The connection over which to send the request.request - The request to send.java.io.IOException - If there is an error sending the request.protected Response readResponse(java.net.HttpURLConnection connection) throws java.io.IOException
Response from an existing connection. This method should only be
called on a connection for which the entire request has been sent.connection - The connection that sent the response.Responsejava.io.IOException - If there is an error reading the response from the connection.