Class HttpClientDownloader

java.lang.Object
us.codecraft.webmagic.downloader.AbstractDownloader
us.codecraft.webmagic.downloader.HttpClientDownloader
All Implemented Interfaces:
Downloader

public class HttpClientDownloader extends AbstractDownloader
The http downloader based on HttpClient.
Since:
0.1.0
Author:
code4crafter@gmail.com
  • Constructor Details

    • HttpClientDownloader

      public HttpClientDownloader()
  • Method Details

    • setHttpUriRequestConverter

      public void setHttpUriRequestConverter(HttpUriRequestConverter httpUriRequestConverter)
    • setProxyProvider

      public void setProxyProvider(ProxyProvider proxyProvider)
    • download

      public Page download(Request request, Task task)
      Description copied from interface: Downloader
      Downloads web pages and store in Page object.
      Parameters:
      request - request
      task - 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