public static class HttpFetcher.Builder extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
Builder() |
| Modifier and Type | Method and Description |
|---|---|
HttpFetcher |
build()
Builds the fetcher with the options specified.
|
HttpFetcher.Builder |
compressed(boolean compressed)
Set whether to request for compress pages and to decompress pages
after it is fetched.
|
HttpFetcher.Builder |
connectionRequestTimeout(int connectionRequestTimeout)
The timeout in milliseconds used when requesting a connection
from the connection manager.
|
HttpFetcher.Builder |
connectTimeout(int connectTimeout)
Determines the timeout in milliseconds until a connection is established.
|
HttpFetcher.Builder |
fileManager(FileManager fileManager)
Sets the FileManager to be used.
|
HttpFetcher.Builder |
headers(Map<String,String> headers)
Sets the headers to be used when fetching items.
|
HttpFetcher.Builder |
numIoThreads(int numIoThreads)
Number of httpclient dispatcher threads.
|
HttpFetcher.Builder |
proxyProvider(ProxyProvider proxyProvider)
Sets the ProxyProvider to be used.
|
HttpFetcher.Builder |
register(Callback callback)
Register any callbacks that will be called when a page has been fetched.
|
HttpFetcher.Builder |
router(ValidatorRouter router)
Sets ValidatorRouter to be used.
|
HttpFetcher.Builder |
socketTimeout(int socketTimeout)
Defines the socket timeout (
SO_TIMEOUT) in milliseconds,
which is the timeout for waiting for data or, put differently,
a maximum period inactivity between two consecutive data packets). |
HttpFetcher.Builder |
soTimeout(int soTimeout)
Determines the default socket timeout value for non-blocking I/O operations.
|
HttpFetcher.Builder |
stopCodes(int... codes) |
HttpFetcher.Builder |
threadFactory(ThreadFactory threadFactory)
Set the thread factory that creates the httpclient dispatcher
threads.
|
HttpFetcher.Builder |
userAgentGenerator(UserAgentGenerator userAgentGenerator)
Sets the UserAgentGenerator to be used, if not set, default will be chosen.
|
HttpFetcher.Builder |
validator(ResponseValidator validator)
Sets the ResponseValidator to be used.
|
public HttpFetcher.Builder register(Callback callback)
callback - A set of FetcherCallback.public HttpFetcher.Builder fileManager(FileManager fileManager)
If fileManager is set, all items fetched will be saved to storage.
fileManager - file manager to be used.public HttpFetcher.Builder headers(Map<String,String> headers)
headers - a map to headers to be used.public HttpFetcher.Builder numIoThreads(int numIoThreads)
numIoThreads - number of threads.public HttpFetcher.Builder proxyProvider(ProxyProvider proxyProvider)
proxyProvider - proxy provider to be usedpublic HttpFetcher.Builder stopCodes(int... codes)
public HttpFetcher.Builder threadFactory(ThreadFactory threadFactory)
threadFactory - an instance of ThreadFactory.public HttpFetcher.Builder userAgentGenerator(UserAgentGenerator userAgentGenerator)
userAgentGenerator - user agent generator to be used.public HttpFetcher.Builder validator(ResponseValidator validator)
This will validate the fetched page and retry if page is not consistent with the specification set by the validator.
validator - validator to be used.public HttpFetcher.Builder router(ValidatorRouter router)
router - router validator router to be used.public HttpFetcher.Builder connectionRequestTimeout(int connectionRequestTimeout)
connectionRequestTimeout - timeout.public HttpFetcher.Builder connectTimeout(int connectTimeout)
connectTimeout - timeout.public HttpFetcher.Builder socketTimeout(int socketTimeout)
SO_TIMEOUT) in milliseconds,
which is the timeout for waiting for data or, put differently,
a maximum period inactivity between two consecutive data packets).socketTimeout - timeout.public HttpFetcher.Builder soTimeout(int soTimeout)
soTimeout - timeout.public HttpFetcher.Builder compressed(boolean compressed)
compressed - should request for compress pagespublic HttpFetcher build()
Copyright © 2018. All rights reserved.