The HTTP resource and the related File Backed HTTP Resource allow configuration to be retrieved from an web server. In In contrast to the Spring UrlResource, significant control of the underlying Apache underlying Apache HttpClient library is available. For instance the following can be controlled, such as:
- In-memory or file backed caching. This This caching is at the HTTP client level . It and allows a reduction of the HTTP traffic since data is only loaded when it has gone out of date. These These caches do not survive the lifetime of the HttpClient, and in particular they so are not available when the across IdP restarts.
- Connection timeouts and other connection-related configuration.
- Proxy information
- Security and certificate information.
- and so on
For details on advanced usage, refer to the HttpClientConfiguration topic.
Configuring the HTTP Resource
The HTTP Resource is configured entirely via its constructor. The two parameters are the URL and an Apache HttpClient. Two beans (
shibboleth.FileCachingHttpClient) Some built-in beans are provided to simplify construction use of the HttpClient. These are , configured via properties detailed in ReloadableServicesin the HttpClientConfiguration topic.
The File backed HTTP Resource provides file backup for when the web server is unavailable. Note that this file is a orthogonal to the use of a file-backed HttpClient cache, which provides a local copy of up to date data when the web server can be contacted.
The following simple examples rely on the default security behavior of the HttpClient. Use of more explicit security configuration is recommended, and examples of that can be found on the HttpClientConfiguration page.
A resource which will be supplied from an in-memory cache for as long as the file on the webserver does not change. If the webserver becomes unavailable the resource will be unavailable.