Class FakeURLClassLoader

All Implemented Interfaces:
Closeable, AutoCloseable

public class FakeURLClassLoader extends URLClassLoader
FakeURLClassLoader

A URLClassloader that overrides the getURLs() method to return the list of urls passed in to the constructor, but otherwise acts as if it has no urls, which would cause it to delegate to the parent classloader (in this case an OSGi classloader).

The main use of this class is with jars containing tlds. Jasper expects a URL classloader to inspect for jars with tlds.

  • Constructor Details

    • FakeURLClassLoader

      public FakeURLClassLoader(ClassLoader osgiClassLoader, URL[] jars)
  • Method Details

    • getURLs

      public URL[] getURLs()
      Overrides:
      getURLs in class URLClassLoader
      Returns:
      the jars that contains tlds so that TldLocationsCache or TldScanner can find them.
    • toString

      public String toString()
      Overrides:
      toString in class Object