Uploaded image for project: 'apiman (API Management)'
  1. apiman (API Management)
  2. APIMAN-1123

Set the thread context classloader to the PluginClassloader when executing plugin policies

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Done
    • Blocker
    • 1.2.4.Final, 1.2.x
    • None
    • None
    • None

    Description

      References:

      https://github.com/apiman/apiman/blob/master/gateway/engine/core/src/main/java/io/apiman/gateway/engine/policy/RequestChain.java#L65

      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
              try {
                  Thread.currentThread().setContextClassLoader(MyPolicy.class.getClassLoader());
                  // Execute policy here
              } finally {
                  Thread.currentThread().setContextClassLoader(oldLoader);
              }
      

      We may need to do this in the following places:

      • When first loading a policy class (in case the policy class has static initializers)
      • When instantiating the policy (in case the policy has instance initializers)
      • When executing the policy (apply())

      Attachments

        Activity

          People

            ewittman@redhat.com Eric Wittmann
            ewittman@redhat.com Eric Wittmann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: