Class ClassLoaderContextUtils

Object
se.curity.identityserver.sdk.ClassLoaderContextUtils

public final class ClassLoaderContextUtils extends Object
Utility class for dealing with Jakarta EE functionality that requires loading services from a ClassLoader that includes Curity Plugins' classes.

This is needed, for example, when loading SOAP services (JAXB, JAX-WS etc.).

  • Constructor Details

    • ClassLoaderContextUtils

      public ClassLoaderContextUtils(ClassLoader pluginClassLoader)
  • Method Details

    • fromClass

      public static ClassLoaderContextUtils fromClass(Class<?> pluginClass)
      Create a ClassLoaderContextUtils instance based on a class that is declared in a Curity Plugin.
      Parameters:
      pluginClass - a class that is declared in a Curity Plugin.
      Returns:
      new instance of ClassLoaderContextUtils for the plugin that owns the given class.
    • withPluginClassLoader

      public <T> T withPluginClassLoader(Supplier<T> supplier)
      Run the given supplier such that the current context ClassLoader is set to this Curity Plugin's ClassLoader rather than the system loader.

      Once this method returns, the context ClassLoader is restored to whatever value it was before this method was called.

      Type Parameters:
      T - type of return value
      Parameters:
      supplier - to run
      Returns:
      value returned by the supplier