public final class HttpUrlConnectionResponse extends AbstractHttpResponse<java.net.HttpURLConnection> implements HttpResponse<java.net.HttpURLConnection>
| Constructor and Description |
|---|
HttpUrlConnectionResponse(java.net.HttpURLConnection connection,
HttpRequest<java.net.HttpURLConnection> request)
Constructs the
HttpUrlConnectionResponse associated with the specified
connection and request. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the connection.
|
java.io.InputStream |
getContent()
Returns the HTTP response as
InputStream object. |
java.util.Map<java.lang.String,java.lang.String> |
getHeaders() |
HttpRequest<java.net.HttpURLConnection> |
getRequest() |
java.lang.String |
getStatus()
Returns the HTTP response status message.
|
int |
getStatusCode()
Returns the HTTP response status code.
|
java.net.HttpURLConnection |
getUnderlying() |
toStringpublic HttpUrlConnectionResponse(java.net.HttpURLConnection connection,
HttpRequest<java.net.HttpURLConnection> request)
throws java.io.IOException
HttpUrlConnectionResponse associated with the specified
connection and request.connection - the associated connection that generated this response.request - the associated request that generated this response.java.io.IOExceptionpublic java.io.InputStream getContent()
throws java.io.IOException
HttpResponseInputStream object.getContent in interface HttpResponse<java.net.HttpURLConnection>InputStream object.java.io.IOException - if an error occurs during getting content.public int getStatusCode()
throws java.io.IOException
HttpResponsegetStatusCode in interface HttpResponse<java.net.HttpURLConnection>java.io.IOException - if an error occurs during retrieving status code.public java.lang.String getStatus()
throws java.io.IOException
HttpResponsegetStatus in interface HttpResponse<java.net.HttpURLConnection>java.io.IOException - if an error occurs during retrieving status text.public HttpRequest<java.net.HttpURLConnection> getRequest()
getRequest in interface HttpResponse<java.net.HttpURLConnection>public java.net.HttpURLConnection getUnderlying()
getUnderlying in interface HttpResponse<java.net.HttpURLConnection>public java.util.Map<java.lang.String,java.lang.String> getHeaders()
getHeaders in interface HttpResponse<java.net.HttpURLConnection>public void close()
HttpResponseclose in interface HttpResponse<java.net.HttpURLConnection>