# SimpleHttpFetcher (Crawler-commons 0.6-SNAPSHOT API)
Date: 2015-05-26

crawlercommons.fetcher.http

## Class SimpleHttpFetcher

- java.lang.Object
- - crawlercommons.fetcher.BaseFetcher
  - - crawlercommons.fetcher.http.BaseHttpFetcher
    - - crawlercommons.fetcher.http.SimpleHttpFetcher

All Implemented Interfaces:
  Serializable

    public class SimpleHttpFetcher
    extends BaseHttpFetcher

See Also:
  Serialized Form

### Nested Class Summary

Nested Classes
`static class` `SimpleHttpFetcher.IdleConnectionMonitorThread`
`static class` `SimpleHttpFetcher.MyConnectionKeepAliveStrategy`

### Nested classes/interfaces inherited from class crawlercommons.fetcher.http.BaseHttpFetcher

`BaseHttpFetcher.RedirectMode`

### Field Summary

### Fields inherited from class crawlercommons.fetcher.http.BaseHttpFetcher

`_acceptLanguage, _maxConnectionsPerHost, _maxRedirects, _maxThreads, _minResponseRate, _redirectMode, _userAgent, DEFAULT_ACCEPT_LANGUAGE, DEFAULT_MAX_CONNECTIONS_PER_HOST, DEFAULT_MAX_REDIRECTS, DEFAULT_MIN_RESPONSE_RATE, DEFAULT_REDIRECT_MODE, NO_MIN_RESPONSE_RATE, NO_REDIRECTS`

### Fields inherited from class crawlercommons.fetcher.BaseFetcher

`_defaultMaxContentSize, _maxContentSizes, _validMimeTypes, DEFAULT_MAX_CONTENT_SIZE`

### Constructor Summary

Constructors
Constructor and Description
`SimpleHttpFetcher(int maxThreads, UserAgent userAgent)`
`SimpleHttpFetcher(UserAgent userAgent)`

### Method Summary

Methods
`void` `abort()` Terminate any async request being processed.
`FetchedResult` `fetch(org.apache.http.client.methods.HttpRequestBase request, String url, Payload payload)`
`FetchedResult` `fetch(String url)`
`protected void` `finalize()`
`FetchedResult` `get(String url, Payload payload)` Get the content stored in the resource referenced by <url>
`int` `getConnectionTimeout()`
`org.apache.http.HttpVersion` `getHttpVersion()`
`int` `getMaxRetryCount()`
`int` `getSocketTimeout()`
`void` `setConnectionTimeout(int connectionTimeoutInMs)`
`void` `setHttpVersion(org.apache.http.HttpVersion httpVersion)`
`void` `setMaxRetryCount(int maxRetryCount)`
`void` `setSocketTimeout(int socketTimeoutInMs)`

### Methods inherited from class crawlercommons.fetcher.http.BaseHttpFetcher

`getAcceptLanguage, getMaxConnectionsPerHost, getMaxRedirects, getMaxThreads, getMinResponseRate, getRedirectMode, getUserAgent, setAcceptLanguage, setMaxConnectionsPerHost, setMaxRedirects, setMinResponseRate, setRedirectMode`

### Methods inherited from class crawlercommons.fetcher.BaseFetcher

`addValidMimeType, addValidMimeTypes, get, getDefaultMaxContentSize, getMaxContentSize, getMimeTypeFromContentType, getValidMimeTypes, setDefaultMaxContentSize, setMaxContentSize, setValidMimeTypes`

### Methods inherited from class java.lang.Object

`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### SimpleHttpFetcher

    public SimpleHttpFetcher(UserAgent userAgent)

#### SimpleHttpFetcher

    public SimpleHttpFetcher(int maxThreads,
                     UserAgent userAgent)

### Method Detail

#### getHttpVersion

    public org.apache.http.HttpVersion getHttpVersion()

#### setHttpVersion

    public void setHttpVersion(org.apache.http.HttpVersion httpVersion)

#### getSocketTimeout

    public int getSocketTimeout()

#### setSocketTimeout

    public void setSocketTimeout(int socketTimeoutInMs)

#### getConnectionTimeout

    public int getConnectionTimeout()

#### setConnectionTimeout

    public void setConnectionTimeout(int connectionTimeoutInMs)

#### getMaxRetryCount

    public int getMaxRetryCount()

#### setMaxRetryCount

    public void setMaxRetryCount(int maxRetryCount)

#### get

    public FetchedResult get(String url,
                    Payload payload)
                      throws BaseFetchException

Description copied from class: `BaseFetcher`
Get the content stored in the resource referenced by <url>

Specified by:
  `get` in class `BaseFetcher`
Returns:
Throws:
  `BaseFetchException`

#### fetch

    public FetchedResult fetch(String url)
                        throws BaseFetchException

Throws:
  `BaseFetchException`

#### fetch

    public FetchedResult fetch(org.apache.http.client.methods.HttpRequestBase request,
                      String url,
                      Payload payload)
                        throws BaseFetchException

Throws:
  `BaseFetchException`

#### abort

    public void abort()

Description copied from class: `BaseFetcher`
Terminate any async request being processed.

Specified by:
  `abort` in class `BaseFetcher`

#### finalize

    protected void finalize()

Overrides:
  `finalize` in class `Object`