Class CachingWebAppClassLoader

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, ClassVisibilityChecker

    @ManagedObject
    public class CachingWebAppClassLoader
    extends WebAppClassLoader
    A WebAppClassLoader that caches getResource(String) results. Specifically this ClassLoader caches not found classes and resources, which can greatly increase performance for applications that search for resources.
    • Constructor Detail

      • CachingWebAppClassLoader

        public CachingWebAppClassLoader​(java.lang.ClassLoader parent,
                                        WebAppClassLoader.Context context)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • CachingWebAppClassLoader

        public CachingWebAppClassLoader​(WebAppClassLoader.Context context)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • getResource

        public java.net.URL getResource​(java.lang.String name)
        Description copied from class: WebAppClassLoader
        Get a resource from the classloader NOTE: this method provides a convenience of hacking off a leading / should one be present. This is non-standard and it is recommended to not rely on this behavior
        Overrides:
        getResource in class WebAppClassLoader
      • loadClass

        public java.lang.Class<?> loadClass​(java.lang.String name)
                                     throws java.lang.ClassNotFoundException
        Overrides:
        loadClass in class java.lang.ClassLoader
        Throws:
        java.lang.ClassNotFoundException