[
https://issues.apache.org/jira/browse/HTTPCLIENT-2385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18012606#comment-18012606
]
ASF subversion and git services commented on HTTPCLIENT-2385:
-------------------------------------------------------------
Commit 0d4b9a91174dd6a9b9c32634344dd0d1be988622 in httpcomponents-client's
branch refs/heads/dependabot/maven/org.apache.commons-commons-compress-1.28.0
from winfriedgerlach
[ https://gitbox.apache.org/repos/asf?p=httpcomponents-client.git;h=0d4b9a911 ]
HTTPCLIENT-2385: make DefaultManagedHttpClientConnection and DefaultM… (#692)
> Make Default...ClientConnection extensible
> ------------------------------------------
>
> Key: HTTPCLIENT-2385
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2385
> Project: HttpComponents HttpClient
> Issue Type: Improvement
> Reporter: Winfried Gerlach
> Priority: Major
> Fix For: 5.6-alpha1
>
> Time Spent: 2h 10m
> Remaining Estimate: 0h
>
> I'd like to improve extensibility of {{DefaultManagedHttpClientConnection}}
> and {{{}DefaultManagedAsyncClientConnection{}}}. My request somehow resembles
> the very old issue HTTPCLIENT-1374, in which
> {{DefaultManagedHttpClientConnection}} was 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 (as it was in 4.x)
> * -make {{{}LoggingInputStream{}}}, {{{}LoggingOutputStream{}}}, and
> {{LoggingSocketHolder}} public-
> This shouldn't hurt anyone (doesn't break APIs) and help some users like our
> project.
> I'll provide a PR via GitHub:
> [https://github.com/apache/httpcomponents-client/pull/692]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]