[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpclient-commons-dev
Subject:    [jira] [Resolved] (HTTPCORE-731) Don't deprecate HttpClient.execute
From:       "Oleg Kalnichevski (Jira)" <jira () apache ! org>
Date:       2022-12-16 14:41:00
Message-ID: JIRA.13514223.1671196758000.208874.1671201660031 () Atlassian ! JIRA
[Download RAW message or body]


     [ https://issues.apache.org/jira/browse/HTTPCORE-731?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel \
]

Oleg Kalnichevski resolved HTTPCORE-731.
----------------------------------------
    Resolution: Not A Problem

> Don't deprecate HttpClient.execute
> ----------------------------------
> 
> Key: HTTPCORE-731
> URL: https://issues.apache.org/jira/browse/HTTPCORE-731
> Project: HttpComponents HttpCore
> Issue Type: Improvement
> Affects Versions: 5.2
> Reporter: Pierre N.
> Priority: Major
> 
> I just upgraded from 5.1 to 5.2 and just saw that the HttpClient.execute has been \
> deprecated in favor of a ResponseHandler passed by parameter. While I understand \
> you point of view and the potential risk of non closed resource, I wanted to let \
> you know it is not very pleasant to work with callback based API. It create non \
> straight forward code, we have to use and create a lot of exception and the code is \
> less readable and maintenable (very similar to javascript callback hell). I really \
> prefer the previous way which should be used with a try-with-resource block to \
> avoid leak. Imagine if every closeable resource would have to be open with callback \
> ? Socket, File, Malloc ! etc. It would be very painful. Please could you leave some \
> responsibility to your API users ? Most of us know how to close a resource handle \
> :D 
> 
> {code:java}
> /*
> * @deprecated It is strongly recommended to use execute methods with {@link \
>                 HttpClientResponseHandler}
> * such as {@link #execute(ClassicHttpRequest, HttpClientResponseHandler)} in order
> * to ensure automatic resource deallocation by the client.
> * For special cases one can still use {@link #executeOpen(HttpHost, \
>                 ClassicHttpRequest, HttpContext)}
> * to keep the response object open after the request execution.
> *
> * @see #execute(ClassicHttpRequest, HttpClientResponseHandler)
> * @see #executeOpen(HttpHost, ClassicHttpRequest, HttpContext)
> */
> @Deprecated
> HttpResponse execute(ClassicHttpRequest request) throws IOException; {code}
> 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic