Class 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  
    • 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 given HttpHost and HttpRequest get a URI from the pair that I can use as an identifier KEY into my HttpCache
      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.
      java.lang.String getVariantURI​(org.apache.http.HttpHost host, org.apache.http.HttpRequest req, HttpCacheEntry entry)
      For a given HttpHost and HttpRequest 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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • BASE_URI

        private static final java.net.URI BASE_URI
    • Constructor Detail

      • CacheKeyGenerator

        CacheKeyGenerator()
    • 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 given HttpHost and HttpRequest get a URI from the pair that I can use as an identifier KEY into my HttpCache
        Parameters:
        host - The host for this request
        req - the HttpRequest
        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 given HttpHost and HttpRequest 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 request
        req - the HttpRequest
        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 request
        entry - cache entry in question that has variants
        Returns:
        a String variant key