You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Blakeslee, Todd" <Bl...@diebold.com> on 2001/09/07 20:39:12 UTC

RE: [PATCH] Fixes servlet-mapping in web.xml file generated by Js pC u sing the -webxml and -webinc options

I don't think the change you made fixes what I described in Bug #3499, which deals with the file separator character on the Windows OS is being used instead of the '/' character as used in a URL.  That is why I called "replace('\\', '/')" on the string representing the JSP filename for the url-pattern.

Here is the patch for 3499 to revision 1.9

------------------------------------------------------------------------------

cvs diff -u JspC.java (in directory D:\Tomcat4-cvs\jakarta-tomcat-4.0\jasper\src\share\org\apache\jasper)
Index: JspC.java
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspC.java,v
retrieving revision 1.9
diff -u -r1.9 JspC.java
--- JspC.java	2001/09/07 17:57:46	1.9
+++ JspC.java	2001/09/07 18:32:56
@@ -403,7 +403,7 @@
                 mappingout.write("\n\t<servlet-mapping>\n\t\t<servlet-name>");
                 mappingout.write(thisServletName);
                 mappingout.write("</servlet-name>\n\t\t<url-pattern>");
-                mappingout.write(file);
+                mappingout.write(file.replace('\\', '/'));
                 mappingout.write("</url-pattern>\n\t</servlet-mapping>\n");
 
             }

*****CVS exited normally with code 1*****

-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@apache.org]
Sent: Friday, September 07, 2001 2:04 PM
To: 'tomcat-dev@jakarta.apache.org'
Subject: Re: [PATCH] Fixes servlet-mapping in web.xml file generated by
JspC u sing the -webxml and -webinc options


Great minds think alike :-).  I just committed exactly this fix, plus your
fix for the generated DOCTYPE heading.  Thanks!

Craig


On Fri, 7 Sep 2001, Blakeslee, Todd wrote:

> Date: Fri, 7 Sep 2001 14:02:53 -0400
> From: "Blakeslee, Todd" <Bl...@diebold.com>
> Reply-To: tomcat-dev@jakarta.apache.org
> To: "'tomcat-dev@jakarta.apache.org'" <to...@jakarta.apache.org>
> Subject: [PATCH] Fixes servlet-mapping in web.xml file generated by JspC
>     u sing the -webxml and -webinc options
>
> This patch fixes the following bug reports. Testing on Windows 2000 w/ SP2, JDK 1.3.1, and jakarta-tomcat-4.0-20010906.
>
> web.xml file generated by JspC is not valid as defined by DTD.
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3474
>
> Invalid url-pattern for servlet-mapping in web.xml file generated by JspC on Windows OS.
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3499
>
> ----------------------------------------------------------------------
>
> cvs diff -u D:/Tomcat4-cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspC.java
> Index: D:/Tomcat4-cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspC.java
> ===================================================================
> RCS file: /home/cvspublic/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspC.java,v
> retrieving revision 1.8
> diff -u -r1.8 JspC.java
> --- D:/Tomcat4-cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspC.java	2001/02/04 01:03:42	1.8
> +++ D:/Tomcat4-cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspC.java	2001/09/07 16:46:10
> @@ -400,11 +400,11 @@
>                  servletout.write("</servlet-class>\n\t</servlet>\n");
>              }
>              if (mappingout != null) {
> -                mappingout.write("\n\t<servlet-mapping>\n\t\t<url-pattern>");
> -                mappingout.write(file);
> -                mappingout.write("</url-pattern>\n\t\t<servlet-name>");
> +                mappingout.write("\n\t<servlet-mapping>\n\t\t<servlet-name>");
>                  mappingout.write(thisServletName);
> -                mappingout.write("</servlet-name>\n\t</servlet-mapping>\n");
> +                mappingout.write("</servlet-name>\n\t\t<url-pattern>");
> +                mappingout.write(file.replace('\\', '/'));
> +                mappingout.write("</url-pattern>\n\t</servlet-mapping>\n");
>              }
>              return true;
>          } catch (JasperException je) {
>
> *****CVS exited normally with code 1*****
>
> ----------------------------------------------------------------------
> Todd R. Blakeslee [mailto:blakest@diebold.com]
>