import org.apache.wicket.Request;
import org.apache.wicket.Response;
import org.apache.wicket.Session;
+import org.apache.wicket.application.IClassResolver;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.protocol.http.WebApplication;
}
// customize the Wicket class resolver to load from plugins
- PluginClassResolver classResolver = new PluginClassResolver(pluginManager);
+ IClassResolver coreResolver = getApplicationSettings().getClassResolver();
+ PluginClassResolver classResolver = new PluginClassResolver(coreResolver, pluginManager);
getApplicationSettings().setClassResolver(classResolver);
getMarkupSettings().setDefaultMarkupEncoding("UTF-8");
import java.util.Set;
import java.util.TreeSet;
-import org.apache.wicket.Application;
import org.apache.wicket.WicketRuntimeException;
import org.apache.wicket.application.IClassResolver;
import org.slf4j.Logger;
public class PluginClassResolver implements IClassResolver {
private static final Logger logger = LoggerFactory.getLogger(PluginClassResolver.class);
+ private final IClassResolver coreResolver;
private final IPluginManager pluginManager;
- public PluginClassResolver(IPluginManager pluginManager) {
+ public PluginClassResolver(IClassResolver coreResolver, IPluginManager pluginManager) {
+ this.coreResolver = coreResolver;
this.pluginManager = pluginManager;
}
}
}
- throw new ClassNotFoundException(className);
+ return coreResolver.resolveClass(className);
}
@Override
}
}
+ Iterator<URL> it = coreResolver.getResources(name);
+ while (it.hasNext()) {
+ URL url = it.next();
+ urls.add(url);
+ }
return urls.iterator();
}
// Try the classloader for the wicket jar/bundle
Enumeration<URL> resources = plugin.getPluginClassLoader().getResources(name);
loadResources(resources, loadedFiles);
-
- // Try the classloader for the user's application jar/bundle
- resources = Application.get().getClass().getClassLoader().getResources(name);
- loadResources(resources, loadedFiles);
-
- // Try the context class loader
- resources = Thread.currentThread().getContextClassLoader().getResources(name);
- loadResources(resources, loadedFiles);
} catch (IOException e) {
throw new WicketRuntimeException(e);
}