public class HttpCache extends AbstractHttpFetcher
Modifier and Type | Class and Description |
---|---|
private static class |
HttpCache.DefaultHttpResponse |
private static class |
HttpCache.ResponseBody |
Modifier and Type | Field and Description |
---|---|
private org.apache.http.client.HttpClient |
_client
HttpClient used to place the HTTP requests.
|
private java.util.Map |
_getCache
Cache for GET requests.
|
private java.util.Map |
_headCache
Cache for HEAD requests.
|
private static org.apache.commons.logging.Log |
_log |
private static boolean |
DEBUG |
Constructor and Description |
---|
HttpCache() |
HttpCache(javax.net.ssl.SSLContext sslContext) |
HttpCache(javax.net.ssl.SSLContext sslContext,
org.apache.http.conn.ssl.X509HostnameVerifier hostnameVerifier)
Constructs a new HttpCache object, that will be initialized with the
default set of HttpRequestOptions.
|
Modifier and Type | Method and Description |
---|---|
HttpResponse |
get(java.lang.String url,
HttpRequestOptions requestOptions)
GETs a HTTP URL.
|
private HttpCache.ResponseBody |
getResponseBody(org.apache.http.HttpEntity response,
int maxBodySize)
Returns content of an HTTP response entitity, but no more than maxBytes.
|
HttpResponse |
head(java.lang.String url,
HttpRequestOptions requestOptions) |
private boolean |
match(HttpCache.DefaultHttpResponse resp,
HttpRequestOptions requestOptions) |
HttpResponse |
post(java.lang.String url,
java.util.Map<java.lang.String,java.lang.String> parameters,
HttpRequestOptions requestOptions) |
private void |
removeGet(java.lang.String url)
Removes a cached GET response.
|
private java.util.List<org.apache.http.NameValuePair> |
toList(java.util.Map<java.lang.String,java.lang.String> parameters) |
get, getDefaultRequestOptions, getRequestOptions, head, post, setDefaultRequestOptions
private static org.apache.commons.logging.Log _log
private static final boolean DEBUG
private org.apache.http.client.HttpClient _client
private java.util.Map _getCache
private java.util.Map _headCache
public HttpCache()
public HttpCache(javax.net.ssl.SSLContext sslContext)
public HttpCache(javax.net.ssl.SSLContext sslContext, org.apache.http.conn.ssl.X509HostnameVerifier hostnameVerifier)
HttpRequestOptions
private void removeGet(java.lang.String url)
url
- The URL for which to remove the cached response.public HttpResponse get(java.lang.String url, HttpRequestOptions requestOptions) throws java.io.IOException
HttpFetcher
get
in interface HttpFetcher
get
in class AbstractHttpFetcher
url
- The HTTP URL to GET.java.io.IOException
HttpRequestOptions, HttpResponse
private java.util.List<org.apache.http.NameValuePair> toList(java.util.Map<java.lang.String,java.lang.String> parameters)
public HttpResponse post(java.lang.String url, java.util.Map<java.lang.String,java.lang.String> parameters, HttpRequestOptions requestOptions) throws java.io.IOException
post
in interface HttpFetcher
post
in class AbstractHttpFetcher
java.io.IOException
private HttpCache.ResponseBody getResponseBody(org.apache.http.HttpEntity response, int maxBodySize) throws java.io.IOException
java.io.IOException
private boolean match(HttpCache.DefaultHttpResponse resp, HttpRequestOptions requestOptions)
public HttpResponse head(java.lang.String url, HttpRequestOptions requestOptions) throws java.io.IOException
head
in interface HttpFetcher
head
in class AbstractHttpFetcher
java.io.IOException
Copyright 2006-2008 Sxip Identity Corporation