Class Http
java.lang.Object
org.apache.nutch.protocol.http.api.HttpBase
org.apache.nutch.protocol.httpclient.Http
- All Implemented Interfaces:
Configurable,Pluggable,Protocol
This class is a protocol plugin that configures an HTTP client for Basic, Digest and NTLM authentication schemes for web server as well as proxy server. It takes care of HTTPS protocol as well as cookies in a single fetch session.
Documentation can be found on the Nutch HttpAuthenticationSchemes wiki page.
The original description of the motivation to support HttpPostAuthentication is also included on the Nutch wiki. Additionally HttpPostAuthentication development is documented at the NUTCH-827 Jira issue.
- Author:
- Susam Pal
-
Field Summary
FieldsFields inherited from class org.apache.nutch.protocol.http.api.HttpBase
accept, acceptCharset, acceptLanguage, BUFFER_SIZE, COOKIE, enableCookieHeader, enableIfModifiedsinceHeader, maxContent, maxCrawlDelay, maxDuration, partialAsTruncated, proxyException, proxyHost, proxyPort, proxyType, RESPONSE_TIME, responseTime, storeHttpHeaders, storeHttpRequest, storeIPAddress, storeProtocolVersions, timeout, tlsCheckCertificate, tlsPreferredCipherSuites, tlsPreferredProtocols, useHttp11, useHttp2, useProxy, userAgentFields inherited from interface org.apache.nutch.protocol.Protocol
X_POINT_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ResponsegetResponse(URL url, CrawlDatum datum, boolean redirect) Fetches theurlwith a configured HTTP client and gets the response.static voidMain method.voidsetConf(Configuration conf) Reads the configuration from the Nutch configuration files and sets the configuration.Methods inherited from class org.apache.nutch.protocol.http.api.HttpBase
getAccept, getAcceptCharset, getAcceptLanguage, getConf, getCookie, getMaxContent, getMaxDuration, getProtocolOutput, getProxyHost, getProxyPort, getRobotRules, getRobotRules, getTimeout, getTlsPreferredCipherSuites, getTlsPreferredProtocols, getUseHttp11, getUserAgent, isCookieEnabled, isIfModifiedSinceEnabled, isProxyException, isStoreHttpHeaders, isStoreHttpRequest, isStoreIPAddress, isStorePartialAsTruncated, isTlsCheckCertificates, logConf, main, processDeflateEncoded, processGzipEncoded, useProxy, useProxy, useProxyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.nutch.protocol.Protocol
resolveUrl
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG
-
-
Constructor Details
-
Http
public Http()Constructs this plugin.
-
-
Method Details
-
setConf
Reads the configuration from the Nutch configuration files and sets the configuration.- Specified by:
setConfin interfaceConfigurable- Overrides:
setConfin classHttpBase- Parameters:
conf- Configuration
-
main
Main method.- Parameters:
args- Command line arguments- Throws:
Exception- if a fatal error is encountered whilst running the program
-
getResponse
protected Response getResponse(URL url, CrawlDatum datum, boolean redirect) throws ProtocolException, IOException Fetches theurlwith a configured HTTP client and gets the response.- Specified by:
getResponsein classHttpBase- Parameters:
url- URL to be fetcheddatum- Crawl dataredirect- Follow redirects if and only if true- Returns:
- HTTP response
- Throws:
ProtocolExceptionIOException
-