Class HttpSnifferConfig
java.lang.Object
com.norconex.collector.http.fetch.impl.webdriver.HttpSnifferConfig
- All Implemented Interfaces:
IXMLConfigurable
Configuration for HttpSniffer.
XML configuration usage:
<port>(default is 0 = random free port)</port>
<host>(default is "localhost")</host>
<userAgent>(optionally overwrite browser user agent)</userAgent>
<maxBufferSize>
(Maximum byte size before a request/response content is considered
too large. Can be specified using notations, e.g., 25MB.
Zero or less means unlimited. Default is 10MB)
</maxBufferSize>
<responseTimeout>
How long to wait for the HTTP response from the target host to be
processed.
</responseTimeout>
<!-- Optional HTTP request headers passed on every HTTP requests -->
<headers>
<!-- You can repeat this header tag as needed. -->
<header
name="(header name)">
(header value)
</header>
</headers>
<!-- Optional chained proxy -->
<chainedProxy/>
The above XML configurable options can be nested in a supporting parent tag of any name. The expected parent tag name is defined by the consuming classes (e.g. "httpSniffer").
- Since:
- 3.0.0
- Author:
- Pascal Essiembre
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets chained proxy settings, if any.getHost()Gets the host name passed to the browser pointing to the sniffer proxy.intintgetPort()Gets the amount of time for the HTTP sniffer to wait for the target host response matching the request being "sniffed".inthashCode()voidloadFromXML(XML xml) voidvoidsetChainedProxy(ProxySettings chainedProxy) Sets chained proxy settings, if any.voidSets the host name passed to the browser pointing to the sniffer proxy.voidsetMaxBufferSize(int maxBufferSize) voidsetPort(int port) voidsetRequestHeaders(Map<String, String> requestHeaders) voidsetResponseTimeout(Duration responseTimeout) Gets the amount of time for the HTTP sniffer to wait for the target host response matching the request being "sniffed".voidsetUserAgent(String userAgent) toString()
-
Field Details
-
DEFAULT_MAX_BUFFER_SIZE
public static final int DEFAULT_MAX_BUFFER_SIZE -
DEFAULT_RESPONSE_TIMEOUT
-
-
Constructor Details
-
HttpSnifferConfig
public HttpSnifferConfig()
-
-
Method Details
-
getPort
public int getPort() -
setPort
public void setPort(int port) -
getHost
Gets the host name passed to the browser pointing to the sniffer proxy. Defaults to "localhost".- Returns:
- host name
- Since:
- 3.1.0
-
setHost
Sets the host name passed to the browser pointing to the sniffer proxy.- Parameters:
host- host name- Since:
- 3.1.0
-
getUserAgent
-
setUserAgent
-
getRequestHeaders
-
setRequestHeaders
-
getMaxBufferSize
public int getMaxBufferSize() -
setMaxBufferSize
public void setMaxBufferSize(int maxBufferSize) -
getResponseTimeout
Gets the amount of time for the HTTP sniffer to wait for the target host response matching the request being "sniffed". Default is 2 minutes.- Returns:
- a duration
- Since:
- 3.1.0
-
setResponseTimeout
Gets the amount of time for the HTTP sniffer to wait for the target host response matching the request being "sniffed". Default is 2 minutes.- Parameters:
responseTimeout- response timeout- Since:
- 3.1.0
-
getChainedProxy
Gets chained proxy settings, if any. That is, when the sniffer proxy has to itself use a proxy.- Returns:
- chained proxy settings
- Since:
- 3.1.0
-
setChainedProxy
Sets chained proxy settings, if any. That is, when the sniffer proxy has to itself use a proxy.- Parameters:
chainedProxy- chained proxy settings- Since:
- 3.1.0
-
loadFromXML
- Specified by:
loadFromXMLin interfaceIXMLConfigurable
-
saveToXML
- Specified by:
saveToXMLin interfaceIXMLConfigurable
-
equals
-
hashCode
public int hashCode() -
toString
-