public class RemoteLiveWebCache extends Object implements LiveWebCache
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.httpclient.MultiThreadedHttpConnectionManager |
connectionManager |
protected org.apache.commons.httpclient.HostConfiguration |
hostConfiguration |
protected org.apache.commons.httpclient.HttpClient |
http |
protected String |
requestPrefix |
Constructor and Description |
---|
RemoteLiveWebCache() |
Modifier and Type | Method and Description |
---|---|
Resource |
getCachedResource(URL url,
long maxCacheMS,
boolean bUseOlder)
Fetch a Resource from the live web, or from a cache of the live web.
|
int |
getConnectionTimeoutMS() |
org.apache.commons.httpclient.HttpClient |
getHttpClient() |
int |
getMaxHostConnections() |
int |
getMaxTotalConnections() |
String |
getRequestPrefix() |
int |
getSocketTimeoutMS() |
void |
setConnectionTimeoutMS(int connectionTimeoutMS) |
void |
setMaxHostConnections(int maxHostConnections) |
void |
setMaxTotalConnections(int maxTotalConnections) |
void |
setProxyHostPort(String hostPort) |
void |
setRequestPrefix(String requestPrefix) |
void |
setSocketTimeoutMS(int socketTimeoutMS) |
void |
shutdown()
closes all resources
|
protected org.apache.commons.httpclient.MultiThreadedHttpConnectionManager connectionManager
protected org.apache.commons.httpclient.HostConfiguration hostConfiguration
protected org.apache.commons.httpclient.HttpClient http
protected String requestPrefix
public Resource getCachedResource(URL url, long maxCacheMS, boolean bUseOlder) throws LiveDocumentNotAvailableException, LiveWebCacheUnavailableException, LiveWebTimeoutException, IOException
LiveWebCache
getCachedResource
in interface LiveWebCache
url
- to fetch from the live web.maxCacheMS
- maximum age of resource to return - optionally honoredbUseOlder
- if true, return documents older than maxCacheMS if
a more recent copy is not available.LiveDocumentNotAvailableException
- if the resource cannot be
retrieved from the live web, but all proxying and caching
mechanisms functioned properlyLiveWebCacheUnavailableException
- if there was a problem either
accessing the live web, in proxying to the live web, or in
maintaining the cache for the live webLiveWebTimeoutException
- if there is no response from the live
web cache before a timeout occurred.IOException
- for the usual reasonspublic void shutdown()
LiveWebCache
shutdown
in interface LiveWebCache
public void setProxyHostPort(String hostPort)
hostPort
- to proxy requests through - ex. "localhost:3128"public void setMaxTotalConnections(int maxTotalConnections)
maxTotalConnections
- the HttpConnectionManagerParams configpublic int getMaxTotalConnections()
public void setMaxHostConnections(int maxHostConnections)
maxHostConnections
- the HttpConnectionManagerParams configpublic int getMaxHostConnections()
public int getConnectionTimeoutMS()
public void setConnectionTimeoutMS(int connectionTimeoutMS)
connectionTimeoutMS
- the connectionTimeoutMS to setpublic int getSocketTimeoutMS()
public void setSocketTimeoutMS(int socketTimeoutMS)
socketTimeoutMS
- the socketTimeoutMS to setpublic String getRequestPrefix()
public void setRequestPrefix(String requestPrefix)
public org.apache.commons.httpclient.HttpClient getHttpClient()
Copyright © 2005–2015 IIPC. All rights reserved.