#1 Lenient pathname for WebappClassLoader.getResourceAsStream()

closed-fixed
nobody
None
5
2007-12-29
2007-08-21
Tom Poindexter
No

This patch adds a lenient getResourceAsStream() in
WebappClassLoader.java. I've run into a few
WAR files that read internal resources, and contain
a leading '/' for the pathnames. Other servers (Jetty,
Tomcat, et.al.) are lenient of this by removing the leading '/'. Without this patch, the InputStream
returned is null, and cause the deployed servlet to
mis-behave.

This patch adds a simple getResourceAsStream() to
deal with this. Also, I've included winstone/classLoader/* classes when building the
-lite version so that this patch is included in the -lite version as well. I've also made a similar patch to
ReloadingClassLoader.java.

Discussion

  • Tom Poindexter
    Tom Poindexter
    2007-08-21

    Lenient pathname for WebappClassLoader.getResourceAsStream()

     
  • Rick Knowles
    Rick Knowles
    2007-12-29

    • status: open --> closed-fixed
     
  • Rick Knowles
    Rick Knowles
    2007-12-29

    Logged In: YES
    user_id=716353
    Originator: NO

    Applied in cvs. Thanks.

    Normally I don't like patches like this because babysitting a developers abuse of the classloading API is completely at odds with the goal of small size (the "we don't protect you from yourself" mantra applies here), but since it's quite small and in an optional package winstone.classLoader and therefore not in the lite jar, in this case I'll let it through.

    The maven.xml change was deliberately left out - I don't want this in the lite jar. The ReloadingClassLoader inherits from WebappClassLoader, so that was unnecessary too.