protected static class ThrottledFetcher.ThrottledConnection extends java.lang.Object implements IThrottledConnection
| Modifier and Type | Field and Description |
|---|---|
protected AbortChecker |
abortCheck
Abort checker
|
protected PageCredentials |
authentication
Authentication
|
protected int |
connectionTimeoutMilliseconds
Connection timeout milliseconds
|
protected org.apache.http.conn.HttpClientConnectionManager |
connManager
The http connection manager.
|
protected long |
expireTime
This is when the connection will expire.
|
protected long |
fetchCounter
The current bytes in the current fetch
|
protected org.apache.http.client.methods.HttpRequestBase |
fetchMethod
The method object
|
protected org.apache.manifoldcf.connectorcommon.interfaces.IFetchThrottler |
fetchThrottler
Fetch throttler
|
protected java.lang.String |
fetchType
The kind of fetch we are doing
|
protected org.apache.http.client.HttpClient |
httpClient
The http client object.
|
protected javax.net.ssl.SSLSocketFactory |
httpsSocketFactory
Https protocol
|
protected LoginCookies |
lastFetchCookies
The cookies from the last fetch
|
protected ThrottledFetcher.ExecuteMethodThread |
methodThread
The thread that is actually doing the work
|
protected ThrottledFetcher.ConnectionPool |
myPool
Connection pool
|
protected java.lang.String |
myUrl
The current URL being fetched
|
protected int |
port
Port
|
protected java.lang.String |
protocol
Protocol
|
protected java.lang.String |
proxyAuthDomain
Proxy auth domain
|
protected java.lang.String |
proxyAuthPassword
Proxy auth password
|
protected java.lang.String |
proxyAuthUsername
Proxy auth user name
|
protected java.lang.String |
proxyHost
Proxy host
|
protected int |
proxyPort
Proxy port
|
protected java.lang.String |
server
Server
|
protected int |
socketTimeoutMilliseconds
Socket timeout milliseconds
|
protected long |
startFetchTime
The start of the current fetch
|
protected int |
statusCode
The status code fetched, if any
|
protected boolean |
threadStarted
Set if thread has been started
|
protected java.lang.Throwable |
throwable
The error trace, if any
|
_rcsid, FETCH_BAD_URI, FETCH_CIRCULAR_REDIRECT, FETCH_INTERRUPTED, FETCH_IO_ERROR, FETCH_NOT_TRIED, FETCH_SEQUENCE_ERROR, FETCH_UNKNOWN_ERROR| Constructor and Description |
|---|
ThrottledConnection(ThrottledFetcher.ConnectionPool myPool,
org.apache.manifoldcf.connectorcommon.interfaces.IFetchThrottler fetchThrottler,
java.lang.String protocol,
java.lang.String server,
int port,
PageCredentials authentication,
javax.net.ssl.SSLSocketFactory httpsSocketFactory,
java.lang.String proxyHost,
int proxyPort,
java.lang.String proxyAuthDomain,
java.lang.String proxyAuthUsername,
java.lang.String proxyAuthPassword,
int socketTimeoutMilliseconds,
int connectionTimeoutMilliseconds)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
beginFetch(java.lang.String fetchType)
Begin the fetch process.
|
void |
close()
Close the connection.
|
void |
destroy()
Destroy the connection forever
|
void |
doneFetch(org.apache.manifoldcf.crawler.interfaces.IProcessActivity activities)
Done with the fetch.
|
void |
executeFetch(java.lang.String urlPath,
java.lang.String userAgent,
java.lang.String from,
boolean redirectOK,
java.lang.String host,
FormData formData,
LoginCookies loginCookies)
Execute the fetch and get the return code.
|
LoginCookies |
getLastFetchCookies()
Get the last fetch cookies.
|
java.lang.String |
getLimitedResponseBody(int maxSize,
java.lang.String encoding)
Get limited response as a string.
|
java.io.InputStream |
getResponseBodyStream()
Get the response input stream.
|
int |
getResponseCode()
Get the http response code.
|
java.lang.String |
getResponseHeader(java.lang.String headerName)
Get a specified response header, if it exists.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getResponseHeaders()
Get response headers
|
protected void |
handleHTTPException(org.apache.http.HttpException e,
java.lang.String activity) |
protected void |
handleIOException(java.io.IOException e,
java.lang.String activity) |
boolean |
hasExpired(long currentTime)
Check whether the connection has expired.
|
void |
logFetchCount(int count)
Log the fetch of a number of bytes, from within a stream.
|
void |
noteInterrupted(java.lang.Throwable e)
Note that the connection fetch was interrupted by something.
|
void |
setAbortChecker(AbortChecker abortCheck)
Set the abort checker.
|
protected final ThrottledFetcher.ConnectionPool myPool
protected final org.apache.manifoldcf.connectorcommon.interfaces.IFetchThrottler fetchThrottler
protected final java.lang.String protocol
protected final java.lang.String server
protected final int port
protected final PageCredentials authentication
protected long expireTime
protected org.apache.http.conn.HttpClientConnectionManager connManager
protected org.apache.http.client.HttpClient httpClient
protected org.apache.http.client.methods.HttpRequestBase fetchMethod
protected java.lang.Throwable throwable
protected java.lang.String myUrl
protected int statusCode
protected java.lang.String fetchType
protected long fetchCounter
protected long startFetchTime
protected LoginCookies lastFetchCookies
protected final java.lang.String proxyHost
protected final int proxyPort
protected final java.lang.String proxyAuthDomain
protected final java.lang.String proxyAuthUsername
protected final java.lang.String proxyAuthPassword
protected final javax.net.ssl.SSLSocketFactory httpsSocketFactory
protected final int socketTimeoutMilliseconds
protected final int connectionTimeoutMilliseconds
protected ThrottledFetcher.ExecuteMethodThread methodThread
protected boolean threadStarted
protected AbortChecker abortCheck
public ThrottledConnection(ThrottledFetcher.ConnectionPool myPool, org.apache.manifoldcf.connectorcommon.interfaces.IFetchThrottler fetchThrottler, java.lang.String protocol, java.lang.String server, int port, PageCredentials authentication, javax.net.ssl.SSLSocketFactory httpsSocketFactory, java.lang.String proxyHost, int proxyPort, java.lang.String proxyAuthDomain, java.lang.String proxyAuthUsername, java.lang.String proxyAuthPassword, int socketTimeoutMilliseconds, int connectionTimeoutMilliseconds)
public void setAbortChecker(AbortChecker abortCheck)
setAbortChecker in interface IThrottledConnectionpublic boolean hasExpired(long currentTime)
hasExpired in interface IThrottledConnectioncurrentTime - is the current time to use to judge if a connection has expired.public void logFetchCount(int count)
public void destroy()
destroy in interface IThrottledConnectionpublic void beginFetch(java.lang.String fetchType)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
beginFetch in interface IThrottledConnectionfetchType - is a short descriptive string describing the kind of fetch being requested. This
is used solely for logging purposes.org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionorg.apache.manifoldcf.agents.interfaces.ServiceInterruptionpublic void executeFetch(java.lang.String urlPath,
java.lang.String userAgent,
java.lang.String from,
boolean redirectOK,
java.lang.String host,
FormData formData,
LoginCookies loginCookies)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
executeFetch in interface IThrottledConnectionurlPath - is the path part of the url, e.g. "/robots.txt"userAgent - is the value of the userAgent header to use.from - is the value of the from header to use.redirectOK - should be set to true if you want redirects to be automatically followed.host - is the value to use as the "Host" header, or null to use the default.formData - describes additional form arguments and how to fetch the page.loginCookies - describes the cookies that should be in effect for this page fetch.org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionorg.apache.manifoldcf.agents.interfaces.ServiceInterruptionpublic int getResponseCode()
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
getResponseCode in interface IThrottledConnectionorg.apache.manifoldcf.core.interfaces.ManifoldCFExceptionorg.apache.manifoldcf.agents.interfaces.ServiceInterruptionpublic LoginCookies getLastFetchCookies() throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
getLastFetchCookies in interface IThrottledConnectionorg.apache.manifoldcf.core.interfaces.ManifoldCFExceptionorg.apache.manifoldcf.agents.interfaces.ServiceInterruptionpublic java.util.Map<java.lang.String,java.util.List<java.lang.String>> getResponseHeaders()
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
getResponseHeaders in interface IThrottledConnectionorg.apache.manifoldcf.core.interfaces.ManifoldCFExceptionorg.apache.manifoldcf.agents.interfaces.ServiceInterruptionpublic java.lang.String getResponseHeader(java.lang.String headerName)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
getResponseHeader in interface IThrottledConnectionheaderName - is the name of the header.org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionorg.apache.manifoldcf.agents.interfaces.ServiceInterruptionpublic java.io.InputStream getResponseBodyStream()
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
getResponseBodyStream in interface IThrottledConnectionorg.apache.manifoldcf.core.interfaces.ManifoldCFExceptionorg.apache.manifoldcf.agents.interfaces.ServiceInterruptionpublic java.lang.String getLimitedResponseBody(int maxSize,
java.lang.String encoding)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
getLimitedResponseBody in interface IThrottledConnectionorg.apache.manifoldcf.core.interfaces.ManifoldCFExceptionorg.apache.manifoldcf.agents.interfaces.ServiceInterruptionpublic void noteInterrupted(java.lang.Throwable e)
noteInterrupted in interface IThrottledConnectionpublic void doneFetch(org.apache.manifoldcf.crawler.interfaces.IProcessActivity activities)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
doneFetch in interface IThrottledConnectionorg.apache.manifoldcf.core.interfaces.ManifoldCFExceptionpublic void close()
close in interface IThrottledConnectionprotected void handleHTTPException(org.apache.http.HttpException e,
java.lang.String activity)
throws org.apache.manifoldcf.agents.interfaces.ServiceInterruption,
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruptionorg.apache.manifoldcf.core.interfaces.ManifoldCFExceptionprotected void handleIOException(java.io.IOException e,
java.lang.String activity)
throws org.apache.manifoldcf.agents.interfaces.ServiceInterruption,
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruptionorg.apache.manifoldcf.core.interfaces.ManifoldCFException