tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Mathewson <ni...@MIT.EDU>
Subject BUG&FIX: Generated web.inc/web.xml do not conform to DTD
Date Thu, 17 Aug 2000 16:14:57 GMT

Hello, all.  Please forgive me if I'm submitting this bug incorrectly;
I wasn't able to find more specific instructions at the website.

The problem is this:  when JspC.java generates web.inc or web.xml, it
produces something like this:
    <servlet-mapping>
       <url-pattern>/foo</url-pattern>
       <servlet-name>com.bar.fooservlet</servlet-name>
    </servlet-mapping>

This is incorrect; according to p.65 of Sun's servlet specification 2.2,
the servlet-name element must precede the url-pattern element. 

This problem definitely exists in the stable release (3.1r*), and [as far
as I can tell from inspecting the code] exists in all CVS version as well.

Here is a patch against the stable release; patching the CVS version should
be trivial.

----
diff -ur jakarta-orig/src/share/org/apache/jasper/JspC.java jakarta-tomcat/src/share/org/apache/jasper/JspC.java
--- jakarta-orig/src/share/org/apache/jasper/JspC.java	    Wed Mar 29 23:28:06 2000+++ jakarta-tomcat/src/share/org/apache/jasper/JspC.java
Thu Aug 17 11:58:23 2000
@@ -370,11 +370,11 @@
                 mapout.write(thisServletName);
                 mapout.write("</servlet-name>\n\t\t<servlet-class>");
                 mapout.write(thisServletName);
-                mapout.write("</servlet-class>\n\t</servlet>\n\t<servlet-mapping>\n\t\t<url-pattern>");
-                mapout.write(file);
-                mapout.write("</url-pattern>\n\t\t<servlet-name>");
+                mapout.write("</servlet-class>\n\t</servlet>\n\t<servlet-mapping>\n\t\t<servlet-name>");
                 mapout.write(thisServletName);
-                mapout.write("</servlet-name>\n\t</servlet-mapping>\n");
+                mapout.write("</servlet-name>\n\t\t<url-pattern>");
+                mapout.write(file);
+                mapout.write("</url-pattern>\n\t</servlet-mapping>\n");
             };
             return true;
         } catch (JasperException je) {

----

Yours, 
-- 
Nick

Mime
View raw message