Class ETagCachingWire

  • All Implemented Interfaces:
    Wire

    @Immutable
    public final class ETagCachingWire
    extends AbstractHeaderBasedCachingWire
    Wire that caches requests with ETags.

    This decorator can be used when you want to avoid duplicate requests to load-sensitive resources and server supports ETags, for example:

    
        String html = new JdkRequest("http://goggle.com")
            .through(ETagCachingWire.class)
            .fetch()
            .body();
     

    Client will automatically detect if server uses ETags and start adding corresponding If-None-Match to outgoing requests

    Client will take response from the cache if it is present or will query resource for that.

    The class is immutable and thread-safe.

    Since:
    2.0
    • Constructor Detail

      • ETagCachingWire

        public ETagCachingWire​(Wire wire)
        Public ctor.
        Parameters:
        wire - Original wire