Class CacheKeyGenerator
- java.lang.Object
-
- org.apache.http.impl.client.cache.CacheKeyGenerator
-
@Contract(threading=IMMUTABLE) class CacheKeyGenerator extends java.lang.Object
- Since:
- 4.1
-
-
Field Summary
Fields Modifier and Type Field Description private static java.net.URI
BASE_URI
-
Constructor Summary
Constructors Constructor Description CacheKeyGenerator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
canonicalizeUri(java.lang.String uri)
protected java.lang.String
getFullHeaderValue(org.apache.http.Header[] headers)
(package private) static java.net.URI
getRequestUri(org.apache.http.HttpRequest request, org.apache.http.HttpHost target)
(package private) static URIBuilder
getRequestUriBuilder(org.apache.http.HttpRequest request)
java.lang.String
getURI(org.apache.http.HttpHost host, org.apache.http.HttpRequest req)
For a givenHttpHost
andHttpRequest
get a URI from the pair that I can use as an identifier KEY into my HttpCachejava.lang.String
getVariantKey(org.apache.http.HttpRequest req, HttpCacheEntry entry)
Compute a "variant key" from the headers of a given request that are covered by the Vary header of a given cache entry.java.lang.String
getVariantURI(org.apache.http.HttpHost host, org.apache.http.HttpRequest req, HttpCacheEntry entry)
For a givenHttpHost
andHttpRequest
if the request has a VARY header - I need to get an additional URI from the pair of host and request so that I can also store the variant into my HttpCache.(package private) static java.net.URI
normalize(java.net.URI requestUri)
-
-
-
Method Detail
-
getRequestUriBuilder
static URIBuilder getRequestUriBuilder(org.apache.http.HttpRequest request) throws java.net.URISyntaxException
- Throws:
java.net.URISyntaxException
-
getRequestUri
static java.net.URI getRequestUri(org.apache.http.HttpRequest request, org.apache.http.HttpHost target) throws java.net.URISyntaxException
- Throws:
java.net.URISyntaxException
-
normalize
static java.net.URI normalize(java.net.URI requestUri) throws java.net.URISyntaxException
- Throws:
java.net.URISyntaxException
-
getURI
public java.lang.String getURI(org.apache.http.HttpHost host, org.apache.http.HttpRequest req)
For a givenHttpHost
andHttpRequest
get a URI from the pair that I can use as an identifier KEY into my HttpCache- Parameters:
host
- The host for this requestreq
- theHttpRequest
- Returns:
- String the extracted URI
-
canonicalizeUri
public java.lang.String canonicalizeUri(java.lang.String uri)
-
getFullHeaderValue
protected java.lang.String getFullHeaderValue(org.apache.http.Header[] headers)
-
getVariantURI
public java.lang.String getVariantURI(org.apache.http.HttpHost host, org.apache.http.HttpRequest req, HttpCacheEntry entry)
For a givenHttpHost
andHttpRequest
if the request has a VARY header - I need to get an additional URI from the pair of host and request so that I can also store the variant into my HttpCache.- Parameters:
host
- The host for this requestreq
- theHttpRequest
entry
- the parent entry used to track the variants- Returns:
- String the extracted variant URI
-
getVariantKey
public java.lang.String getVariantKey(org.apache.http.HttpRequest req, HttpCacheEntry entry)
Compute a "variant key" from the headers of a given request that are covered by the Vary header of a given cache entry. Any request whose varying headers match those of this request should have the same variant key.- Parameters:
req
- originating requestentry
- cache entry in question that has variants- Returns:
- a
String
variant key
-
-