winfriedgerlach opened a new pull request, #692:
URL: https://github.com/apache/httpcomponents-client/pull/692

   Cf. https://issues.apache.org/jira/browse/HTTPCLIENT-2385:
   
   I'd like to improve extensibility of `DefaultManagedHttpClientConnection` 
and `DefaultManagedAsyncClientConnection`. My request somehow resembles the 
very old issue 
[HTTPCLIENT-1374](https://issues.apache.org/jira/browse/HTTPCLIENT-1374), in 
which `DefaultManagedHttpClientConnection` was initially made public.
   
    
   IMHO, implementations named `Default...` should both demonstrate best 
practices of API usage and act as easily modifiable blueprints for HttpClient 
users. This is currently not the case, because both 
`DefaultManagedHttpClientConnection` and `DefaultManagedAsyncClientConnection` 
are final and `DefaultManagedHttpClientConnection` uses package-private classes 
(Logging...*).
   
   So if you want to write your own, slightly modified 
`MyManagedHttpClientConnection` (e.g., change some logging or call a callback 
when a method is invoked), you will need to extend the super class 
`DefaultBHttpClientConnection` (which is public non-final), copy a lot of code 
from `DefaultManagedHttpClientConnection` and possibly even create your own 
copies of `LoggingInputStream`, `LoggingOutputStream`, and 
`LoggingSocketHolder`. Something that could be done with very few lines of 
code, maybe even in an anonymous class, has then become multiple classes with 
several hundred LoC to review and maintain (especially if 
`DefaultBHttpClientConnection` or `DefaultManagedHttpClientConnection` are 
changed in future versions of HttpClient).
   
   I suggest to
   
   * make `DefaultManagedHttpClientConnection` and 
`DefaultManagedAsyncClientConnection` public non-final
   * make `LoggingInputStream`, `LoggingOutputStream`, and 
`LoggingSocketHolder` public
    
   This shouldn't hurt anyone (doesn't break APIs) and help some users like our 
project.
   
   


-- 
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.

To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org

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