Thomas Warner created HTTPCLIENT-2115:
-----------------------------------------
Summary: 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, 5.0.1
Reporter: Thomas Warner
*[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: [email protected]
For additional commands, e-mail: [email protected]