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 2020/08/29 13:01:00 UTC

[jira] [Updated] (HTTPCLIENT-2115) HttpAsyncClientBuilder build() ignores replaceExecInterceptor()

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

Oleg Kalnichevski updated HTTPCLIENT-2115:
------------------------------------------
    Fix Version/s: 5.0.2

> HttpAsyncClientBuilder build() ignores replaceExecInterceptor() 
> ----------------------------------------------------------------
>
>                 Key: HTTPCLIENT-2115
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2115
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient (async)
>    Affects Versions: 5.0.1, 5.0
>            Reporter: Thomas Warner
>            Priority: Minor
>             Fix For: 5.0.2
>
>
> *[HttpAsyncClientBuilder.replaceExecInterceptor|https://hc.apache.org/httpcomponents-client-5.0.x/httpclient5/apidocs/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.html#replaceExecInterceptor(java.lang.String,%20org.apache.hc.client5.http.async.AsyncExecChainHandler)]*([String|https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true] existing, [AsyncExecChainHandler|https://hc.apache.org/httpcomponents-client-5.0.x/httpclient5/apidocs/org/apache/hc/client5/http/async/AsyncExecChainHandler.html] interceptor) stores the interceptor internally, but is not added to the execChain given to the client that is created on build().
> The problem appears to be in HttpAsyncClientBuilder.build() (starting line 940 in 5.0.1):
>  
> {code:java}
> if (execInterceptors != null) {
>     for (final ExecInterceptorEntry entry: execInterceptors) {
>         switch (entry.postion) {
>             case AFTER:
>                 execChainDefinition.addAfter(entry.existing, entry.interceptor, entry.name);
>                 break;
>             case BEFORE:
>                 execChainDefinition.addBefore(entry.existing, entry.interceptor, entry.name);
>                 break;
>             case FIRST:
>                 execChainDefinition.addFirst(entry.interceptor, entry.name);
>                 break;
>             case LAST:
>                 execChainDefinition.addLast(entry.interceptor, entry.name);
>                 break;
>         }
>     }
> }
> {code}
> Note that there is no case for the RETRY option.
> Potential workaround: addExecInterceptorAfter() or addExecInterceptorBefore(), in which case both exec interceptors are included but ideally the intended exec interceptor supersedes the one you wish to replace.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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