You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2019/02/26 14:32:00 UTC

[jira] [Commented] (HTTPCLIENT-1971) Document alternatives to deprecated AbortableHttpRequest.abort()

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

Oleg Kalnichevski commented on HTTPCLIENT-1971:
-----------------------------------------------

bq. example that uses the deprecated {{HttpGet.abort()}} method.

[~creckord] I do not think this is correct. The example in question is using [HttpUriRequest#abort|https://github.com/apache/httpcomponents-client/blob/4.5.x/httpclient/src/main/java/org/apache/http/client/methods/HttpUriRequest.java#L75] method.

Oleg

> Document alternatives to deprecated AbortableHttpRequest.abort()
> ----------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1971
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1971
>             Project: HttpComponents HttpClient
>          Issue Type: Wish
>          Components: Documentation
>    Affects Versions: 4.5.7
>            Reporter: Carsten Reckord
>            Priority: Minor
>
> The {{AbortableHttpRequest}} interface was deprecated for HttpClient 4.3, but there is no good documentation on what the alternative is for callers who wish to cancel a request who would have previously called e.g. HttpGet.abort().
> The deprecation notice simply says _"use HttpExecutionAware"_. However, looking at {{HttpExecutionAware}} and its usages throughout HttpClient, this is apparenty intended for a different use-case. Or at least it is unclear how callers would achieve the desired cancellation.
> The [examples page|https://hc.apache.org/httpcomponents-client-ga/examples.html] still lists the [Abort method|https://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientAbortMethod.java] example that uses the deprecated {{HttpGet.abort()}} method.
> [Another example|https://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientWithRequestFuture.java] that isn't listed on the examples page and hence hard to find shows how to use {{FutureRequestExecutionService}}  to get a cancellable {{HttpRequestFutureTask}}. But looking at the code, that doesn't actually seem to cancel the actual request either - it just offloads it to a worker, and if it isn't already cancelled before the worker runs it, it goes through with the complete request.
>   
>  So far, my impression is that the only proper alternative is to go with the HttpAsyncClient API. But it would be nice if the HttpClient documentation and the deprecation notice on AbortableHttpRequest would either reflect that, or give other alternatives more explicitly.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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