HttpClientFetcher
Fetches web documents using an HTTP client with authentication and SSL support.
Notesβ
Fetches web documents using an HTTP client. Supports authentication (BASIC, DIGEST, NTLM, form-based, Kerberos), SSL configuration, cookie handling, ETag and If-Modified-Since headers, proxy settings, redirect handling, connection pooling, and custom request headers.
Examplesβ
- YAML
- JSON
- XML
class: HttpClientFetcher
authentication:
method: FORM
credentials:
username: joeUser
password: joePassword
formUsernameField: loginUser
formPasswordField: loginPwd
url: http://www.example.com/login/submit
{
"class": "HttpClientFetcher",
"authentication": {
"method": "FORM",
"credentials": {
"username": "joeUser",
"password": "joePassword"
},
"formUsernameField": "loginUser",
"formPasswordField": "loginPwd",
"url": "http://www.example.com/login/submit"
}
}
<class>HttpClientFetcher</class>
<authentication>
<method>FORM</method>
<credentials>
<username>joeUser</username>
<password>joePassword</password>
</credentials>
<formUsernameField>loginUser</formUsernameField>
<formPasswordField>loginPwd</formPasswordField>
<url>http://www.example.com/login/submit</url>
</authentication>
Usageβ
Full configuration skeleton, with every option and its default
- YAML
- JSON
- XML
class: HttpClientFetcher
authentication:
credentials:
password: string
passwordKey: {}
username: string
domain: string
formCharset: string
formParams: {}
formPasswordField: string
formSelector: string
formUsernameField: string
host:
name: string
port: 0
kerberosConfig:
keytabPath: string
krb5ConfigPath: string
loginModuleName: string
principal: string
servicePrincipalName: string
useTicketCache: false
method: FORM
preemptive: false
realm: string
url: string
workstation: string
connectionRequestTimeout: 0
connectionTimeout: 0
cookieSpec: RELAXED
etagDisabled: false
expectContinueEnabled: false
forceCharsetDetection: false
forceContentTypeDetection: false
headersPrefix: string
hstsDisabled: false
httpMethods:
- GET
ifModifiedSinceDisabled: false
localAddress: string
maxConnectionIdleTime: 0
maxConnectionInactiveTime: 0
maxConnections: 0
maxConnectionsPerRoute: 0
maxRedirects: 0
notFoundStatusCodes:
- 0
proxySettings:
credentials:
password: string
passwordKey: {}
username: string
host:
name: string
port: 0
realm: string
scheme: string
redirectUrlProvider:
class: GenericRedirectUrlProvider
fallbackCharset: string
referenceFilters: []
requestHeaders: {}
sniDisabled: false
socketTimeout: 0
sslProtocols:
- string
trustAllSSLCertificates: false
userAgent: string
validStatusCodes:
- 0
{
"class": "HttpClientFetcher",
"authentication": {
"credentials": {
"password": "string",
"passwordKey": {},
"username": "string"
},
"domain": "string",
"formCharset": "string",
"formParams": {},
"formPasswordField": "string",
"formSelector": "string",
"formUsernameField": "string",
"host": {
"name": "string",
"port": 0
},
"kerberosConfig": {
"keytabPath": "string",
"krb5ConfigPath": "string",
"loginModuleName": "string",
"principal": "string",
"servicePrincipalName": "string",
"useTicketCache": false
},
"method": "FORM",
"preemptive": false,
"realm": "string",
"url": "string",
"workstation": "string"
},
"connectionRequestTimeout": 0,
"connectionTimeout": 0,
"cookieSpec": "RELAXED",
"etagDisabled": false,
"expectContinueEnabled": false,
"forceCharsetDetection": false,
"forceContentTypeDetection": false,
"headersPrefix": "string",
"hstsDisabled": false,
"httpMethods": [
"GET"
],
"ifModifiedSinceDisabled": false,
"localAddress": "string",
"maxConnectionIdleTime": 0,
"maxConnectionInactiveTime": 0,
"maxConnections": 0,
"maxConnectionsPerRoute": 0,
"maxRedirects": 0,
"notFoundStatusCodes": [
0
],
"proxySettings": {
"credentials": {
"password": "string",
"passwordKey": {},
"username": "string"
},
"host": {
"name": "string",
"port": 0
},
"realm": "string",
"scheme": "string"
},
"redirectUrlProvider": {
"class": "GenericRedirectUrlProvider",
"fallbackCharset": "string"
},
"referenceFilters": [],
"requestHeaders": {},
"sniDisabled": false,
"socketTimeout": 0,
"sslProtocols": [
"string"
],
"trustAllSSLCertificates": false,
"userAgent": "string",
"validStatusCodes": [
0
]
}
<httpClientFetcher>
<class>HttpClientFetcher</class>
<authentication>
<credentials>
<password>string</password>
<passwordKey/>
<username>string</username>
</credentials>
<domain>string</domain>
<formCharset>string</formCharset>
<formParams/>
<formPasswordField>string</formPasswordField>
<formSelector>string</formSelector>
<formUsernameField>string</formUsernameField>
<host>
<name>string</name>
<port>0</port>
</host>
<kerberosConfig>
<keytabPath>string</keytabPath>
<krb5ConfigPath>string</krb5ConfigPath>
<loginModuleName>string</loginModuleName>
<principal>string</principal>
<servicePrincipalName>string</servicePrincipalName>
<useTicketCache>false</useTicketCache>
</kerberosConfig>
<method>FORM</method>
<preemptive>false</preemptive>
<realm>string</realm>
<url>string</url>
<workstation>string</workstation>
</authentication>
<connectionRequestTimeout>0</connectionRequestTimeout>
<connectionTimeout>0</connectionTimeout>
<cookieSpec>RELAXED</cookieSpec>
<etagDisabled>false</etagDisabled>
<expectContinueEnabled>false</expectContinueEnabled>
<forceCharsetDetection>false</forceCharsetDetection>
<forceContentTypeDetection>false</forceContentTypeDetection>
<headersPrefix>string</headersPrefix>
<hstsDisabled>false</hstsDisabled>
<httpMethods>
<httpMethod>GET</httpMethod>
</httpMethods>
<ifModifiedSinceDisabled>false</ifModifiedSinceDisabled>
<localAddress>string</localAddress>
<maxConnectionIdleTime>0</maxConnectionIdleTime>
<maxConnectionInactiveTime>0</maxConnectionInactiveTime>
<maxConnections>0</maxConnections>
<maxConnectionsPerRoute>0</maxConnectionsPerRoute>
<maxRedirects>0</maxRedirects>
<notFoundStatusCodes>
<notFoundStatusCode>0</notFoundStatusCode>
</notFoundStatusCodes>
<proxySettings>
<credentials>
<password>string</password>
<passwordKey/>
<username>string</username>
</credentials>
<host>
<name>string</name>
<port>0</port>
</host>
<realm>string</realm>
<scheme>string</scheme>
</proxySettings>
<redirectUrlProvider>
<class>GenericRedirectUrlProvider</class>
<fallbackCharset>string</fallbackCharset>
</redirectUrlProvider>
<referenceFilters>
<referenceFilter/>
</referenceFilters>
<requestHeaders/>
<sniDisabled>false</sniDisabled>
<socketTimeout>0</socketTimeout>
<sslProtocols>
<sslProtocol>string</sslProtocol>
</sslProtocols>
<trustAllSSLCertificates>false</trustAllSSLCertificates>
<userAgent>string</userAgent>
<validStatusCodes>
<validStatusCode>0</validStatusCode>
</validStatusCodes>
</httpClientFetcher>
Propertiesβ
| Property | Type | Required | Default |
|---|---|---|---|
authentication | HttpAuthConfig | No | - |
connectionRequestTimeout | integer | No | 30000 |
connectionTimeout | integer | No | 30000 |
cookieSpec | enum | No | RELAXED |
etagDisabled | boolean | No | - |
expectContinueEnabled | boolean | No | false |
forceCharsetDetection | boolean | No | false |
forceContentTypeDetection | boolean | No | false |
headersPrefix | string | No | - |
hstsDisabled | boolean | No | false |
httpMethods | enum[] | No | [GET, HEAD] |
ifModifiedSinceDisabled | boolean | No | false |
localAddress | string | No | - |
maxConnectionIdleTime | integer | No | 10000 |
maxConnectionInactiveTime | integer | No | - |
maxConnections | integer | No | 200 |
maxConnectionsPerRoute | integer | No | 20 |
maxRedirects | integer | No | 50 |
notFoundStatusCodes | integer[] | No | [404] |
proxySettings | ProxySettings | No | ProxySettings |
redirectUrlProvider | RedirectUrlProvider | No | GenericRedirectUrlProvider |
referenceFilters | ReferenceFilter[] | No | - |
requestHeaders | Record<string, string> | No | - |
sniDisabled | boolean | No | false |
socketTimeout | integer | No | 30000 |
sslProtocols | string[] | No | - |
trustAllSSLCertificates | boolean | No | false |
userAgent | string | No | - |
validStatusCodes | integer[] | No | [200] |
Property Detailsβ
authenticationβ
Authentication configuration for sites requiring login. Supports methods such as BASIC, DIGEST, NTLM, form-based, and Kerberos. Default is null (no authentication).
connectionRequestTimeoutβ
The maximum time to wait when requesting a connection from the connection pool. Default is 30 seconds.
connectionTimeoutβ
The maximum time to wait for a connection to be established with the target server. Default is 30 seconds.
cookieSpecβ
The cookie specification policy to use when handling cookies. Supported values are RELAXED (default, lenient parsing), STRICT (strict RFC-compliant parsing), and IGNORE (cookies are ignored entirely).
Allowed Valuesβ
RELAXEDSTRICTIGNORE
etagDisabledβ
When enabled, the If-None-Match ETag HTTP request header is not sent. By default, ETags are used so servers can skip sending unchanged content.
expectContinueEnabledβ
When enabled, the Expect: 100-continue handshake is used before sending the request body, allowing the server to reject the request early based on headers alone.
forceCharsetDetectionβ
When enabled, the character encoding is detected from content rather than relying on the charset value in the Content-Type HTTP response header.
forceContentTypeDetectionβ
When enabled, the content type is detected from the document content rather than relying on the Content-Type HTTP response header.
headersPrefixβ
An optional prefix to prepend to HTTP response header field names when storing them as document metadata. Default is null (no prefix added).
hstsDisabledβ
When enabled, HTTP Strict Transport Security (HSTS) enforcement is disabled, preventing the crawler from automatically upgrading HTTP URLs to HTTPS based on the Strict-Transport-Security response header.
httpMethodsβ
The list of HTTP methods accepted by this fetcher. Defaults to GET and HEAD.
ifModifiedSinceDisabledβ
When enabled, the If-Modified-Since HTTP request header is not sent. By default, this header is sent so servers can respond with 304 Not Modified when content has not changed.
localAddressβ
The local network address (IP) to use for outbound connections. Useful when the machine has multiple network interfaces and a specific one should be used.
maxConnectionIdleTimeβ
The period of time after which idle connections are evicted from the connection pool. Default is 10 seconds.
maxConnectionInactiveTimeβ
The period of inactivity after which a connection is proactively checked to detect stale connections. Default is 0 (not proactively checked).
maxConnectionsβ
The maximum total number of connections that can be created in the connection pool. Typically set to at least the number of crawler threads. Default is 200.
maxConnectionsPerRouteβ
The maximum number of concurrent connections to any single host/route. Default is 20.
maxRedirectsβ
The maximum number of redirects to follow before giving up, which helps prevent infinite redirect loops. Set to zero to disable redirect following. Default is 50.
notFoundStatusCodesβ
HTTP response status codes to be treated as "not found", causing the document to be marked as deleted. Default is [404].
proxySettingsβ
Configures an optional HTTP proxy for outbound connections. Leave unset to connect directly.
redirectUrlProviderβ
Provides the target URL to use when a redirect is encountered. Defaults to GenericRedirectUrlProvider.
referenceFiltersβ
Filters applied to document references (URLs or file paths) to control which ones are fetched. Documents whose references do not pass the filters are skipped.
requestHeadersβ
Custom HTTP headers to be sent with every HTTP request, in addition to default headers provided by the HTTP client.
sniDisabledβ
When enabled, Server Name Indication (SNI) is disabled for SSL/TLS connections. SNI is required for some HTTPS sites that host multiple domains on a single IP.
socketTimeoutβ
The maximum time in milliseconds to wait for data on an established connection before giving up.
sslProtocolsβ
The list of SSL/TLS protocols to support (e.g., TLSv1.2, TLSv1.3). Default is null, which uses the protocols configured by the Java platform.
trustAllSSLCertificatesβ
When enabled, all SSL certificates are trusted, including self-signed or invalid ones. This is a security risk and should only be used in controlled environments. Consider installing a proper certificate instead.
userAgentβ
The user-agent string used to identify the crawler to target web sites. It is highly recommended to always set a meaningful user agent so web site administrators can identify the crawler.
validStatusCodesβ
HTTP response status codes considered successful. Documents with other status codes are not processed normally. Default is [200].