|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.shibboleth.utilities.java.support.httpclient.FileCachingHttpClientBuilder
public class FileCachingHttpClientBuilder
An HttpClient builder that supports RFC 2616 caching.
Cached content is written to disk. Special care should be taken so that multiple clients do not share a single cache directory unintentionally. This could result senstive data being available in ways it should not be.
| Field Summary | |
|---|---|
private File |
cacheDir
Directory in which cached content will be stored. |
private HttpClientBuilder |
clientBuilder
Builder of clients used to fetch data from remote servers. |
private int |
maxCacheEntries
The maximum number of cached responses. |
private int |
maxCacheEntrySize
The maximum response body size, in bytes, that will be eligible for caching. |
| Constructor Summary | |
|---|---|
FileCachingHttpClientBuilder(HttpClientBuilder builder)
Constructor. |
|
| Method Summary | |
|---|---|
HttpClient |
buildClient()
Builds an HTTP client that performs RFC2616 caching. |
File |
getCacheDirectory()
Gets the directory in which cached content will be stored. |
int |
getMaxCacheEntries()
Gets the maximum number of cached responses. |
int |
getMaxCacheEntrySize()
Gets the maximum response body size, in bytes, that will be eligible for caching. |
void |
setCacheDirectory(File directory)
Sets the directory in which cached content will be stored. |
void |
setCacheDirectory(String directoryPath)
Sets the directory in which cached content will be stored. |
void |
setMaxCacheEntries(int maxEntries)
Sets the maximum number of cached responses. |
void |
setMaxCacheEntrySize(int size)
Sets the maximum response body size, in bytes, that will be eligible for caching. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final HttpClientBuilder clientBuilder
private File cacheDir
System.getProperty("java.io.tmpdir") + File.separator + "wwwcache"
private int maxCacheEntries
private int maxCacheEntrySize
| Constructor Detail |
|---|
public FileCachingHttpClientBuilder(@Nonnull
HttpClientBuilder builder)
builder - builder of clients used to fetch data from remote servers| Method Detail |
|---|
public File getCacheDirectory()
public void setCacheDirectory(@Nonnull@NotEmpty
String directoryPath)
directoryPath - filesystem path to the directory
public void setCacheDirectory(@Nonnull
File directory)
directory - the directorypublic int getMaxCacheEntries()
public void setMaxCacheEntries(int maxEntries)
maxEntries - maximum number of cached responses, must be greater than zeropublic int getMaxCacheEntrySize()
public void setMaxCacheEntrySize(int size)
size - maximum response body size that will be eligible for caching, must be greater than zero
public HttpClient buildClient()
throws IOException
IOException - if the cache directory does not exist and can not be created or if it can not be read from or
written to
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||