[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12900688#action_12900688
 ] 

James Abley commented on HTTPCLIENT-983:
----------------------------------------

Constructors would presumably chain if there was such a change made.

The API looks a little bloated from that example. 14 parameters to a 
constructor? Possibly a Builder API with reasonable defaults might be an avenue 
worth exploring.

> Missing a constructor in CachingHttpClient, to provide both customized 
> responseCachingPolicy, etc. and maxObjectSize
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-983
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-983
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: Cache
>            Reporter: Vianney Carel
>            Priority: Trivial
>
> It would be convenient not to be limited to the DEFAULT_MAX_OBJECT_SIZE_BYTES 
> by adding the below constructor:
>      public CachingHttpClient(HttpClient backend, ResponseCachingPolicy 
> responseCachingPolicy,
>             CacheEntryGenerator cacheEntryGenerator, URIExtractor 
> uriExtractor,
>             HttpCache<CacheEntry> responseCache, CachedHttpResponseGenerator 
> responseGenerator,
>             CacheInvalidator cacheInvalidator, CacheableRequestPolicy 
> cacheableRequestPolicy,
>             CachedResponseSuitabilityChecker suitabilityChecker,
>             ConditionalRequestBuilder conditionalRequestBuilder, 
> CacheEntryUpdater entryUpdater,
>             ResponseProtocolCompliance responseCompliance,
>             RequestProtocolCompliance requestCompliance,
>             int maxObjectSizeBytes) {
>         this.maxObjectSizeBytes = maxObjectSizeBytes;
>         this.backend = backend;
>         this.responseCachingPolicy = responseCachingPolicy;
>         this.cacheEntryGenerator = cacheEntryGenerator;
>         this.uriExtractor = uriExtractor;
>         this.responseCache = responseCache;
>         this.responseGenerator = responseGenerator;
>         this.cacheInvalidator = cacheInvalidator;
>         this.cacheableRequestPolicy = cacheableRequestPolicy;
>         this.suitabilityChecker = suitabilityChecker;
>         this.conditionalRequestBuilder = conditionalRequestBuilder;
>         this.cacheEntryUpdater = entryUpdater;
>         this.responseCompliance = responseCompliance;
>         this.requestCompliance = requestCompliance;
>         }
> ... in addition to the existing constructor:
>     public CachingHttpClient(HttpClient backend, ResponseCachingPolicy 
> responseCachingPolicy,
>                              CacheEntryGenerator cacheEntryGenerator, 
> URIExtractor uriExtractor,
>                              HttpCache<CacheEntry> responseCache, 
> CachedHttpResponseGenerator responseGenerator,
>                              CacheInvalidator cacheInvalidator, 
> CacheableRequestPolicy cacheableRequestPolicy,
>                              CachedResponseSuitabilityChecker 
> suitabilityChecker,
>                              ConditionalRequestBuilder 
> conditionalRequestBuilder, CacheEntryUpdater entryUpdater,
>                              ResponseProtocolCompliance responseCompliance,
>                              RequestProtocolCompliance requestCompliance) {
>         this.maxObjectSizeBytes = DEFAULT_MAX_OBJECT_SIZE_BYTES;
>         this.backend = backend;
>         this.responseCachingPolicy = responseCachingPolicy;
>         this.cacheEntryGenerator = cacheEntryGenerator;
>         this.uriExtractor = uriExtractor;
>         this.responseCache = responseCache;
>         this.responseGenerator = responseGenerator;
>         this.cacheInvalidator = cacheInvalidator;
>         this.cacheableRequestPolicy = cacheableRequestPolicy;
>         this.suitabilityChecker = suitabilityChecker;
>         this.conditionalRequestBuilder = conditionalRequestBuilder;
>         this.cacheEntryUpdater = entryUpdater;
>         this.responseCompliance = responseCompliance;
>         this.requestCompliance = requestCompliance;
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to