in the api-docs for ServletContext.getResource( String path ), it is
further specified that:


"This method returns null if no resource is mapped to the pathname."

and

"The path must begin with a "/"..."


are these stipulations in the servlet api-docs valid?


in testing several containers including Tomcat 3.1.1, i was unable to
get a null ( where a test for null would have been, um, desirable ), nor
did it appear that the presence or absence of a leading "/" made any
difference.


by way of contrast, consider the tantalizingly similar:


java.lang.ClassLoader.getResource( String path )

which specifically does *not* expect a leading slash, and very
definitely returns null when the resource does not exist.
 


reference:

http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ServletContext.html

http://java.sun.com/j2se/1.3/docs/api/java/lang/ClassLoader.html

Reply via email to