Class ApacheFcHttpClient
java.lang.Object
org.frontcache.core.ApacheFcHttpClient
- All Implemented Interfaces:
FcHttpClient
The Apache-backed
FcHttpClient. This class and the resilience commands are the only places
in frontcache-core that know an HTTP library exists - everything else, including all three
reflection-loaded extension points, sees only FcHttpClient.
See docs/archive/httpclient5-upgrade-proposal.md section 5.1.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionOne-shot GET with no resilience wrapper and no request context - for bootstrap-time downloads such as prefetching fallback pages.Fetch through whichever origin transport this node uses: an HTTP call in standalone mode, the origin app's own filter chain in webfilter mode.fetchOverHttp(String urlStr, Map<String, List<String>> requestHeaders, RequestContext context) Fetch over HTTP specifically, never the filter chain.org.apache.hc.client5.http.classic.HttpClientThe underlying Apache client.
-
Constructor Details
-
ApacheFcHttpClient
public ApacheFcHttpClient(org.apache.hc.client5.http.classic.HttpClient client)
-
-
Method Details
-
getApacheClient
public org.apache.hc.client5.http.classic.HttpClient getApacheClient()The underlying Apache client. Forfrontcache-coreinternals that build resilience commands themselves; not part ofFcHttpClientand not for extension points. -
fetch
public WebResponse fetch(String urlStr, Map<String, List<String>> requestHeaders, RequestContext context) throws FrontCacheException Description copied from interface:FcHttpClientFetch through whichever origin transport this node uses: an HTTP call in standalone mode, the origin app's own filter chain in webfilter mode. Resilience-wrapped (circuit breaker, bulkhead, time limiter, fallback).- Specified by:
fetchin interfaceFcHttpClient- Parameters:
urlStr- absolute origin URLrequestHeaders- headers to forward; the caller owns the map and it may be mutatedcontext- the per-request context this fetch belongs to- Returns:
- the origin response as a cacheable
WebResponse - Throws:
FrontCacheException
-
fetchOverHttp
public WebResponse fetchOverHttp(String urlStr, Map<String, List<String>> requestHeaders, RequestContext context) throws FrontCacheException Description copied from interface:FcHttpClientFetch over HTTP specifically, never the filter chain. Includes always use this: an include is a different URL from the one being served, so re-running the current request's filter chain would return the wrong page. Resilience-wrapped likeFcHttpClient.fetch(String, Map, RequestContext).- Specified by:
fetchOverHttpin interfaceFcHttpClient- Throws:
FrontCacheException
-
fetch
Description copied from interface:FcHttpClientOne-shot GET with no resilience wrapper and no request context - for bootstrap-time downloads such as prefetching fallback pages. The body is materialised into the returnedWebResponse, which is fine for the small, few, once-per-startup fetches this is for. Unlike the two request-path methods, a non-2xx status is a normal return, not an exception: callers decide what a 404 on a fallback page means.- Specified by:
fetchin interfaceFcHttpClient- Throws:
FrontCacheException
-