Search in sources :

Example 1 with NamespaceURLClassLoader

use of org.xwiki.classloader.NamespaceURLClassLoader in project xwiki-platform by xwiki.

the class ContextNamespaceURLClassLoader method getCurrentClassLoader.

// TODO: Add support for context user ?
private NamespaceURLClassLoader getCurrentClassLoader() {
    String currentWiki = this.wikis.getCurrentWikiId();
    if (this.currentClassLoader == null || !Objects.equals(currentWiki, this.cachedCurrentWiki)) {
        this.currentClassLoader = this.classLoaderManager.getURLClassLoader(currentWiki != null ? "wiki:" + currentWiki : null, false);
        if (this.currentClassLoader == null) {
            // Fallback on system classloader in the very weird edge case where ClassLoaderManager does not return
            // any (which is already supposed to fallback on system classloader)
            this.currentClassLoader = new NamespaceURLClassLoader(new URI[] {}, getSystemClassLoader(), null);
        }
        this.cachedCurrentWiki = currentWiki;
    }
    return this.currentClassLoader;
}
Also used : NamespaceURLClassLoader(org.xwiki.classloader.NamespaceURLClassLoader) URI(java.net.URI)

Aggregations

URI (java.net.URI)1 NamespaceURLClassLoader (org.xwiki.classloader.NamespaceURLClassLoader)1