[EMAIL PROTECTED] wrote:
remm 2005/05/12 06:01:05
Modified: jasper2/src/share/org/apache/jasper/servlet
JspCServletContext.java
webapps/docs changelog.xml
Log:
- 34465: jspc without web.xml.
- Submitted by Yoichi Hirose.
Revision Changes Path
1.4 +7 -1 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspCServletContext.java
Index: JspCServletContext.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspCServletContext.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JspCServletContext.java 17 Mar 2004 19:23:05 -0000 1.3
+++ JspCServletContext.java 12 May 2005 13:01:04 -0000 1.4
@@ -235,7 +235,13 @@
if (!path.startsWith("/"))
throw new MalformedURLException("Path '" + path +
"' does not start with '/'");
- return (new URL(myResourceBaseURL, path.substring(1)));
+ URL url = new URL(myResourceBaseURL, path.substring(1));
+ if ("file".equals(url.getProtocol())) {
+ if (!(new File(url.getFile())).exists()) {
+ return null;
+ }
+ }
+ return url;
}
I don't think this is very efficient. Normally, the resource with the given path will exist. It is just in the case of web.xml that it may not exist.
Why not check specifically for existence of web.xml, as follows:
No, the JspCServletContext is supposed to work as a regular servlet context, so we should really return null if the file does not exist rather than add hacks elsewhere to work around it.
Rémy
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]