Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-2115

HttpAsyncClientBuilder build() ignores replaceExecInterceptor()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 5.0.1, 5.0
    • 5.0.2
    • HttpClient (async)
    • None

    Description

      HttpAsyncClientBuilder.replaceExecInterceptor([String|https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true] existing, AsyncExecChainHandler 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):

       

      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;
              }
          }
      }
      

      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.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            dev-warner Lily Warner
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: