Class ApacheFcHttpClient

java.lang.Object
org.frontcache.core.ApacheFcHttpClient
All Implemented Interfaces:
FcHttpClient

public class ApacheFcHttpClient extends Object implements 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 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. For frontcache-core internals that build resilience commands themselves; not part of FcHttpClient and not for extension points.
    • fetch

      public WebResponse fetch(String urlStr, Map<String, List<String>> requestHeaders, RequestContext context) throws FrontCacheException
      Description copied from interface: FcHttpClient
      Fetch 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:
      fetch in interface FcHttpClient
      Parameters:
      urlStr - absolute origin URL
      requestHeaders - headers to forward; the caller owns the map and it may be mutated
      context - 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: FcHttpClient
      Fetch 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 like FcHttpClient.fetch(String, Map, RequestContext).
      Specified by:
      fetchOverHttp in interface FcHttpClient
      Throws:
      FrontCacheException
    • fetch

      public WebResponse fetch(String urlStr) throws FrontCacheException
      Description copied from interface: FcHttpClient
      One-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 returned WebResponse, 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:
      fetch in interface FcHttpClient
      Throws:
      FrontCacheException