Class HttpResourceFetcher


  • public class HttpResourceFetcher
    extends Object
    • Constructor Detail

      • HttpResourceFetcher

        public HttpResourceFetcher​(org.springframework.http.client.ClientHttpRequestFactory factory,
                                   org.springframework.cache.Cache cache,
                                   Clock clock)
      • HttpResourceFetcher

        public HttpResourceFetcher​(org.springframework.http.client.ClientHttpRequestFactory factory,
                                   org.springframework.cache.Cache cache,
                                   Clock clock,
                                   int defaultTTL,
                                   int minTTL,
                                   boolean serveStale)
        Parameters:
        factory -
        clock -
        defaultTTL - default time to live in milliseconds Default TTL, if no according information is present in the HTTP-headers. If set to 0, caching will be disabled, if no according HTTP-headers are present.
        minTTL - the minimum time to live, if caching is enabled A minimum TTL, that will overwrite the time to live, that was extracted from the HTTP-headers. The minimum TTL is only applied, if the default TTL is set to a value greater than zero, hence enabling caching by default.
        serveStale -
    • Method Detail

      • fetch

        public de.juplo.httpresources.HttpData fetch​(URI uri,
                                                     de.juplo.httpresources.HttpData data)
        Fetches the remote resource and reports, if it was modified. This method fetches the remote resource, if was not already fetched. If the resource was already fetched, it revalidates it, if necessary.
        Returns:
        true, if the resource has changed or was fetched for the first time, otherwise false