Package de.juplo.httpresources
Class HttpResourceFetcher
- java.lang.Object
-
- de.juplo.httpresources.HttpResourceFetcher
-
public class HttpResourceFetcher extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_TTL
-
Constructor Summary
Constructors Constructor Description HttpResourceFetcher(org.springframework.http.client.ClientHttpRequestFactory factory, org.springframework.cache.Cache cache, Clock clock)
HttpResourceFetcher(org.springframework.http.client.ClientHttpRequestFactory factory, org.springframework.cache.Cache cache, Clock clock, int defaultTTL, int minTTL, boolean serveStale)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description de.juplo.httpresources.HttpData
fetch(URI uri, de.juplo.httpresources.HttpData data)
Fetches the remote resource and reports, if it was modified.
-
-
-
Field Detail
-
DEFAULT_TTL
public static final int DEFAULT_TTL
- See Also:
- Constant Field Values
-
-
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 to0
, 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, otherwisefalse
-
-