Package us.codecraft.webmagic.downloader
Class HttpClientDownloader
java.lang.Object
us.codecraft.webmagic.downloader.AbstractDownloader
us.codecraft.webmagic.downloader.HttpClientDownloader
- All Implemented Interfaces:
Downloader
The http downloader based on HttpClient.
- Since:
- 0.1.0
- Author:
- code4crafter@gmail.com
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDownloads web pages and store in Page object.protected Page
handleResponse
(Request request, String charset, org.apache.http.HttpResponse httpResponse, Task task) void
setHttpUriRequestConverter
(HttpUriRequestConverter httpUriRequestConverter) void
setProxyProvider
(ProxyProvider proxyProvider) void
setThread
(int thread) Tell the downloader how many threads the spider used.
-
Constructor Details
-
HttpClientDownloader
public HttpClientDownloader()
-
-
Method Details
-
setHttpUriRequestConverter
-
setProxyProvider
-
download
Description copied from interface:Downloader
Downloads web pages and store in Page object.- Parameters:
request
- requesttask
- task- Returns:
- page
-
setThread
public void setThread(int thread) Description copied from interface:Downloader
Tell the downloader how many threads the spider used.- Parameters:
thread
- number of threads
-
handleResponse
protected Page handleResponse(Request request, String charset, org.apache.http.HttpResponse httpResponse, Task task) throws IOException - Throws:
IOException
-