cdalexndr commented on pull request #303:
URL: 
https://github.com/apache/httpcomponents-client/pull/303#issuecomment-826065583


   The `HttpClientBuilder.build()` returns `CloseableHttpClient` instance, and 
I need to wrap it to provide custom functionality.
   [HTTPCLIENT-2154](https://issues.apache.org/jira/browse/HTTPCLIENT-2154) 
contains example code: using a wrapper (decorator pattern) doesn't work (see 
error comment):
   ```
       class CustomCloseableHttpClient extends CloseableHttpClient {
           private CloseableHttpClient base;
   
           public CustomCloseableHttpClient( CloseableHttpClient httpClient ) {
               this.base= httpClient;
           }
   
           @Override
           protected CloseableHttpResponse doExecute( HttpHost httpHost, 
HttpRequest httpRequest, HttpContext httpContext ) throws IOException, 
ClientProtocolException {
               return base.doExecute( httpHost, httpRequest, httpContext ); 
//<-- error, cannot call protected method
           }
           ....
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to