Ring currently uses the classloader that loaded java.lang.System in resource-response. This classloader doesn't necessarily have access to resources in the WAR, since it may well be higher in the classloader hierarchy.
I think it's considered a best practice to use the context classloader in situations like this. I've applied this change to my fork.
The problem is present at least in Winstone. Tomcat documentation implies it might also behave similarly, but I haven't yet checked this.
I also added a test case which illustrates the problem.
use context classloader for fulfilling resource responses
92f7724
minor formatting fixes
ceed6b1
Looks fine. Thanks for the patch!
Ring currently uses the classloader that loaded java.lang.System in resource-response. This classloader doesn't necessarily have access to resources in the WAR, since it may well be higher in the classloader hierarchy.
I think it's considered a best practice to use the context classloader in situations like this. I've applied this change to my fork.
The problem is present at least in Winstone. Tomcat documentation implies it might also behave similarly, but I haven't yet checked this.
I also added a test case which illustrates the problem.