On Thu, 2020-02-27 at 14:01 -0800, Novice User wrote: > Hi, > > We’re using HTTPClient 4.5.11 with caching enabled to make HTTP GET > calls to our provider. > > The provider returns JSON object and as JSON can miss some keys in > some cases, we want to treat it as bad data and avoid it being > cached. > > There does not seem to be any hook for us to intercept the response > body and inspect it and prevent it from being cached. > > It seems HTTP Client has HttpCacheInvalidator but it would not work > on GET requests, and also I would like something to avoid storing it > in cache in first place if response is bad, rather than doing a post > processing of invalidation. > > Does HTTP client has any ability for us to intercept the response > body before it could be saved in cache? > > Thanks, > Akash
You could subclass CachingHttpClientBuilder, override #decorateMainExec method and insert an extra interceptor between MainExec and CachingExec. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
