|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.gargoylesoftware.htmlunit.HttpWebConnection
public class HttpWebConnection
Default implementation of WebConnection, using the HttpClient library to perform HTTP requests.
| Constructor Summary | |
|---|---|
HttpWebConnection(WebClient webClient)
Creates a new HTTP web connection instance. |
|
| Method Summary | |
|---|---|
protected org.apache.http.impl.client.AbstractHttpClient |
createHttpClient()
Creates the HttpClient that will be used by this WebClient. |
static DownloadedContent |
downloadContent(InputStream is)
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.AbstractHttpClient |
getHttpClient()
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 manager. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HttpWebConnection(WebClient webClient)
webClient - the WebClient that is using this connection| Method Detail |
|---|
public WebResponse getResponse(WebRequest request)
throws IOException
getResponse in interface WebConnectionrequest - the request
IOException - 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.AbstractHttpClient getHttpClient()
protected int getTimeout()
protected org.apache.http.impl.client.AbstractHttpClient 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 response
IOException - in case of problem reading/saving the body
public static DownloadedContent downloadContent(InputStream is)
throws IOException
is - the stream to read
IOException - in case of read issues
protected 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 sent
public void shutdown()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||