public class HttpWebConnection extends Object implements WebConnection
WebConnection, using the HttpClient library to perform HTTP requests.| Constructor and Description |
|---|
HttpWebConnection(WebClient webClient)
Creates a new HTTP web connection instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected org.apache.http.impl.client.HttpClientBuilder |
createHttpClient()
Creates the HttpClient that will be used by this WebClient.
|
static DownloadedContent |
downloadContent(InputStream is)
Deprecated.
as of 2.16, use
downloadContent(InputStream, int) |
static DownloadedContent |
downloadContent(InputStream is,
int maxInMemory)
Reads the content of the stream and saves it in memory or on the file system.
|
protected DownloadedContent |
downloadResponseBody(org.apache.http.HttpResponse httpResponse)
Downloads the response body.
|
protected org.apache.http.impl.client.HttpClientBuilder |
getHttpClientBuilder()
Lazily initializes the internal HTTP client.
|
WebResponse |
getResponse(WebRequest request)
Submits a request and retrieves a response.
|
protected int |
getTimeout()
Returns the timeout to use for socket and connection timeouts for HttpConnectionManager.
|
String |
getVirtualHost()
Gets the virtual host.
|
protected WebResponse |
newWebResponseInstance(WebResponseData responseData,
long loadTime,
WebRequest request)
Constructs an appropriate WebResponse.
|
protected void |
onResponseGenerated(org.apache.http.client.methods.HttpUriRequest httpMethod)
Called when the response has been generated.
|
void |
setVirtualHost(String virtualHost)
Sets the virtual host.
|
void |
shutdown()
Shutdown the connection.
|
public HttpWebConnection(WebClient webClient)
webClient - the WebClient that is using this connectionpublic WebResponse getResponse(WebRequest request) throws IOException
getResponse in interface WebConnectionrequest - the requestIOException - if an IO error occursprotected void onResponseGenerated(org.apache.http.client.methods.HttpUriRequest httpMethod)
httpMethod - the httpMethod used (can be null)protected org.apache.http.impl.client.HttpClientBuilder getHttpClientBuilder()
protected int getTimeout()
protected org.apache.http.impl.client.HttpClientBuilder createHttpClient()
ClientConnectionManager to perform
some tracking; see feature request 1438216).public void setVirtualHost(String virtualHost)
virtualHost - the virtualHost to setpublic String getVirtualHost()
protected DownloadedContent downloadResponseBody(org.apache.http.HttpResponse httpResponse) throws IOException
httpResponse - the web server's responseIOException - in case of problem reading/saving the body@Deprecated public static DownloadedContent downloadContent(InputStream is) throws IOException
downloadContent(InputStream, int)is - the stream to readIOException - in case of read issuespublic static DownloadedContent downloadContent(InputStream is, int maxInMemory) throws IOException
is - the stream to readmaxInMemory - the maximumBytes to store in memory, after which save to a local fileIOException - in case of read issuesprotected WebResponse newWebResponseInstance(WebResponseData responseData, long loadTime, WebRequest request)
responseData - Data that was send backrequest - the request used to get this responseloadTime - How long the response took to be sentpublic void shutdown()
Copyright © 2002–2015 Gargoyle Software Inc.. All rights reserved.