public abstract class CachedHttpService extends java.lang.Object implements BodyEnclosingHttpService
ACCEPT_ENCODING_HEADER, ACCEPT_HEADER, ACCEPT_LANGUAGE_HEADER, AMPERSAND, CONTENT_ENCODING_HEADER, CONTENT_TYPE_HEADER, EQUALS, GZIP_ENCODING, HTTP_PROTOCOL, HTTP_SCHEME, HTTPS_PROTOCOL, QUESTION_MARK, USER_AGENT_HEADER| Constructor and Description |
|---|
CachedHttpService(HttpService httpService,
Cache cache) |
CachedHttpService(HttpService httpService,
Cache cache,
CachingStrategy cachingStrategy) |
CachedHttpService(HttpService httpService,
Cache cache,
CachingStrategy cachingStrategy,
java.lang.Long timeToLive) |
| Modifier and Type | Method and Description |
|---|---|
void |
addHeader(java.lang.String name,
java.lang.String value) |
void |
addHttpServiceProcessor(HttpServiceProcessor httpServiceProcessor) |
void |
addQueryParameter(java.lang.String name,
java.util.Collection<?> values) |
void |
addQueryParameter(java.lang.String name,
java.lang.Object value) |
void |
addUrlSegment(java.lang.Object segment) |
void |
execute() |
<T> T |
execute(Parser parser) |
<T> T |
executeRequest(Parser parser) |
protected java.lang.String |
generateCacheFileName() |
static java.lang.String |
generateCacheFileName(java.lang.String key) |
java.lang.String |
getHeaderValue(java.lang.String key) |
protected abstract java.io.File |
getHttpCacheDirectory(Cache cache) |
HttpResponseWrapper |
getHttpResponseWrapper() |
java.lang.Long |
getTimeToLive() |
java.lang.String |
getUrl() |
java.lang.String |
getUrlSuffix() |
<T> T |
readFromCache(Parser parser) |
void |
setBody(java.lang.String body) |
void |
setConnectionTimeout(java.lang.Integer connectionTimeout) |
void |
setReadTimeout(java.lang.Integer readTimeout) |
void |
setSsl(java.lang.Boolean ssl) |
void |
setTimeToLive(java.lang.Long timeToLive) |
void |
setUserAgent(java.lang.String userAgent) |
void |
setWriteTimeout(java.lang.Integer writeTimeout) |
public CachedHttpService(HttpService httpService, Cache cache)
public CachedHttpService(HttpService httpService, Cache cache, CachingStrategy cachingStrategy)
public CachedHttpService(HttpService httpService, Cache cache, CachingStrategy cachingStrategy, java.lang.Long timeToLive)
public <T> T execute(Parser parser)
execute in interface HttpServiceHttpService.execute(Parser)protected abstract java.io.File getHttpCacheDirectory(Cache cache)
public void execute()
execute in interface HttpServicepublic <T> T readFromCache(Parser parser)
public <T> T executeRequest(Parser parser)
protected java.lang.String generateCacheFileName()
public static java.lang.String generateCacheFileName(java.lang.String key)
public void addHeader(java.lang.String name,
java.lang.String value)
addHeader in interface HttpServicename - The header name.value - The header value.HttpService.addHeader(java.lang.String, java.lang.String)public void addQueryParameter(java.lang.String name,
java.lang.Object value)
addQueryParameter in interface HttpServicename - The parameter name.value - The parameter value.HttpService.addQueryParameter(java.lang.String, java.lang.Object)public void addQueryParameter(java.lang.String name,
java.util.Collection<?> values)
addQueryParameter in interface HttpServicename - The parameter name.values - The parameter values.HttpService.addQueryParameter(java.lang.String, java.util.Collection)public void addUrlSegment(java.lang.Object segment)
addUrlSegment in interface HttpServicesegment - The segment nameHttpService.addUrlSegment(java.lang.Object)public void addHttpServiceProcessor(HttpServiceProcessor httpServiceProcessor)
addHttpServiceProcessor in interface HttpServiceHttpService.addHttpServiceProcessor(HttpServiceProcessor)public void setConnectionTimeout(java.lang.Integer connectionTimeout)
setConnectionTimeout in interface HttpServiceconnectionTimeout - The connection timeout in milliseconds.HttpService.setConnectionTimeout(java.lang.Integer)public void setReadTimeout(java.lang.Integer readTimeout)
setReadTimeout in interface HttpServicepublic void setWriteTimeout(java.lang.Integer writeTimeout)
setWriteTimeout in interface HttpServicepublic void setUserAgent(java.lang.String userAgent)
setUserAgent in interface HttpServiceuserAgent - The user agentHttpService.setUserAgent(java.lang.String)public void setSsl(java.lang.Boolean ssl)
setSsl in interface HttpServiceHttpService.setSsl(java.lang.Boolean)public java.lang.String getUrl()
getUrl in interface HttpServiceHttpService.getUrl()public java.lang.String getUrlSuffix()
getUrlSuffix in interface HttpServiceHttpService.getUrlSuffix()public void setBody(java.lang.String body)
setBody in interface BodyEnclosingHttpServiceBodyEnclosingHttpService.setBody(String)public void setTimeToLive(java.lang.Long timeToLive)
timeToLive - the timeToLive to setpublic java.lang.Long getTimeToLive()
public java.lang.String getHeaderValue(java.lang.String key)
getHeaderValue in interface HttpServicepublic HttpResponseWrapper getHttpResponseWrapper()
getHttpResponseWrapper in interface HttpService