| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
accept
The "Accept" request header value.
|
protected java.lang.String |
acceptCharset
The "Accept-Language" request header value.
|
protected java.lang.String |
acceptLanguage
The "Accept-Language" request header value.
|
static int |
BUFFER_SIZE |
static Text |
COOKIE |
protected boolean |
enableCookieHeader
Controls whether or not to set Cookie HTTP header based on CrawlDatum metadata
|
protected boolean |
enableIfModifiedsinceHeader
Configuration directive for If-Modified-Since HTTP header
|
protected int |
maxContent
The length limit for downloaded content, in bytes.
|
protected long |
maxCrawlDelay
Skip page if Crawl-Delay longer than this value.
|
protected java.util.HashMap |
proxyException
The proxy exception list.
|
protected java.lang.String |
proxyHost
The proxy hostname.
|
protected int |
proxyPort
The proxy port.
|
static Text |
RESPONSE_TIME |
protected boolean |
responseTime
Record response time in CrawlDatum's meta data, see property
http.store.responsetime.
|
protected int |
timeout
The network timeout in millisecond
|
protected java.util.Set<java.lang.String> |
tlsPreferredCipherSuites
Which TLS/SSL cipher suites to support
|
protected java.util.Set<java.lang.String> |
tlsPreferredProtocols
Which TLS/SSL protocols to support
|
protected boolean |
useHttp11
Do we use HTTP/1.1?
|
protected boolean |
useProxy
Indicates if a proxy is used
|
protected java.lang.String |
userAgent
The Nutch 'User-Agent' request header
|
X_POINT_ID| Constructor and Description |
|---|
HttpBase()
Creates a new instance of HttpBase
|
HttpBase(org.slf4j.Logger logger)
Creates a new instance of HttpBase
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getAccept() |
java.lang.String |
getAcceptCharset() |
java.lang.String |
getAcceptLanguage()
Value of "Accept-Language" request header sent by Nutch.
|
Configuration |
getConf() |
int |
getMaxContent() |
ProtocolOutput |
getProtocolOutput(Text url,
CrawlDatum datum)
Returns the
Content for a fetchlist entry. |
java.lang.String |
getProxyHost() |
int |
getProxyPort() |
protected abstract Response |
getResponse(java.net.URL url,
CrawlDatum datum,
boolean followRedirects) |
crawlercommons.robots.BaseRobotRules |
getRobotRules(Text url,
CrawlDatum datum,
java.util.List<Content> robotsTxtContent)
Retrieve robot rules applicable for this URL.
|
int |
getTimeout() |
java.util.Set<java.lang.String> |
getTlsPreferredCipherSuites() |
java.util.Set<java.lang.String> |
getTlsPreferredProtocols() |
boolean |
getUseHttp11() |
java.lang.String |
getUserAgent() |
boolean |
isCookieEnabled() |
boolean |
isIfModifiedSinceEnabled() |
protected void |
logConf() |
protected static void |
main(HttpBase http,
java.lang.String[] args) |
byte[] |
processDeflateEncoded(byte[] compressed,
java.net.URL url) |
byte[] |
processGzipEncoded(byte[] compressed,
java.net.URL url) |
void |
setConf(Configuration conf) |
boolean |
useProxy(java.net.URL url) |
public static final Text RESPONSE_TIME
public static final Text COOKIE
public static final int BUFFER_SIZE
protected java.lang.String proxyHost
protected int proxyPort
protected java.util.HashMap proxyException
protected boolean useProxy
protected int timeout
protected int maxContent
protected java.lang.String userAgent
protected java.lang.String acceptLanguage
protected java.lang.String acceptCharset
protected java.lang.String accept
protected boolean useHttp11
protected boolean responseTime
protected long maxCrawlDelay
protected java.util.Set<java.lang.String> tlsPreferredProtocols
protected java.util.Set<java.lang.String> tlsPreferredCipherSuites
protected boolean enableIfModifiedsinceHeader
protected boolean enableCookieHeader
public HttpBase()
public HttpBase(org.slf4j.Logger logger)
public void setConf(Configuration conf)
setConf in interface Configurablepublic Configuration getConf()
getConf in interface Configurablepublic ProtocolOutput getProtocolOutput(Text url, CrawlDatum datum)
ProtocolContent for a fetchlist entry.getProtocolOutput in interface Protocolpublic java.lang.String getProxyHost()
public int getProxyPort()
public boolean useProxy(java.net.URL url)
public int getTimeout()
public boolean isIfModifiedSinceEnabled()
public boolean isCookieEnabled()
public int getMaxContent()
public java.lang.String getUserAgent()
public java.lang.String getAcceptLanguage()
public java.lang.String getAcceptCharset()
public java.lang.String getAccept()
public boolean getUseHttp11()
public java.util.Set<java.lang.String> getTlsPreferredCipherSuites()
public java.util.Set<java.lang.String> getTlsPreferredProtocols()
protected void logConf()
public byte[] processGzipEncoded(byte[] compressed,
java.net.URL url)
throws java.io.IOException
java.io.IOExceptionpublic byte[] processDeflateEncoded(byte[] compressed,
java.net.URL url)
throws java.io.IOException
java.io.IOExceptionprotected static void main(HttpBase http, java.lang.String[] args) throws java.lang.Exception
java.lang.Exceptionprotected abstract Response getResponse(java.net.URL url, CrawlDatum datum, boolean followRedirects) throws ProtocolException, java.io.IOException
ProtocolExceptionjava.io.IOExceptionpublic crawlercommons.robots.BaseRobotRules getRobotRules(Text url, CrawlDatum datum, java.util.List<Content> robotsTxtContent)
ProtocolgetRobotRules in interface Protocolurl - URL to checkdatum - page datumrobotsTxtContent - container to store responses when fetching the robots.txt file for
debugging or archival purposes. Instead of a robots.txt file, it
may include redirects or an error page (404, etc.). Response
Content is appended to the passed list. If null is passed
nothing is stored.Copyright © 2017 The Apache Software Foundation