|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openid4java.util.AbstractHttpFetcher
org.openid4java.util.HttpCache
public class HttpCache
Wrapper cache around HttpClient providing caching for HTTP requests. Intended to be used to optimize the number of HTTP requests performed during OpenID discovery.
| Nested Class Summary | |
|---|---|
private static class |
HttpCache.DefaultHttpResponse
|
private static class |
HttpCache.ResponseBody
|
| Field Summary | |
|---|---|
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 Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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)
|
| Methods inherited from class org.openid4java.util.AbstractHttpFetcher |
|---|
get, getDefaultRequestOptions, getRequestOptions, head, post, setDefaultRequestOptions |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
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
| Constructor Detail |
|---|
public HttpCache()
public HttpCache(javax.net.ssl.SSLContext sslContext)
public HttpCache(javax.net.ssl.SSLContext sslContext,
org.apache.http.conn.ssl.X509HostnameVerifier hostnameVerifier)
HttpRequestOptions| Method Detail |
|---|
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 HttpFetcherget in class AbstractHttpFetcherurl - The HTTP URL to GET.
java.io.IOExceptionHttpRequestOptions, HttpResponseprivate 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 HttpFetcherpost in class AbstractHttpFetcherjava.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 HttpFetcherhead in class AbstractHttpFetcherjava.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||