I'm working to integrate Cucumber with the Arquillian test framework, and I found a major problem with the ClasspathResourceLoader: there is no way to extend the capabilities of the resource loader to be able to conditionally load resources based on the protocol of each resource's URL. If there's a funky URL protocol that doesn't refer to a filesystem resource or a JAR file, the ClasspathResourceLoader will fail to load the resource.
I ran into this problem while executing Cucumber tests with Arquillian and JBoss AS 7.1.1.Final. When the Cucumber tests are running within JBoss AS, each resource URL returned by ClassLoader.getResources() uses the "vfs" protocol to indicate handling by the JBoss Virtual File System.
Here's the problem:
Currently, there is no way to extend or modify the resource loading behavior of the ClasspathResourceLoader class. I'm looking at having to completely reimplement the ResourceLoader interface and manually providing Backend implementations to the Runtime because of the hard dependency on the ClasspathResourceLoader class in Runtime.loadBackends(). Most of the classes used by the ClasspathResourceLoader are also package-private, so existing code cannot be reused.