https://issues.apache.org/bugzilla/show_bug.cgi?id=52530

             Bug #: 52530
           Summary: Incorrectly accept many url-pattern on a single
                    servlet-mapping in web.xml
           Product: Tomcat 5
           Version: 5.5.26
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Unknown
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: giuse...@eppesuigoccas.homedns.org
    Classification: Unclassified


Dear tomcat developers,
I need to map the same servlet on two different url. I used netbeans 7.0.1 for
managing my whole project, so I used its friendly interface to modify the
web.xml file. What netbeans created is this:

<servlet-mapping>
    <servlet-name>fred</servlet-name>
    <url-pattern>*.jsp</url-pattern>
    <url-pattern>/url</url-pattern>
</servlet-mapping>

This is read by tomcat 5.5 without emitting any error, but only the second
pattern works, while the first one is ignored.

Googling I found that the right way for tomcat 5.5 is this one:

<servlet-mapping>
    <servlet-name>fred</servlet-name>
    <url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>fred</servlet-name>
    <url-pattern>/url</url-pattern>
</servlet-mapping>

And this seems to be right way because tomcat 5.5 is bound to Servlet 2.4.

Spec for Servlet 2.5, on note SRV.19.0.3 titled «Multiple Occurrences of
Servlet Mappings», says:

    Previous versions of the servlet schema allows only a single url-pattern or
servlet name per servlet mapping. For servlets mapped to multiple URLs this
results in needless repetition of whole mapping clauses.

So, I think tomcat 5.5 should emit an error for this broken web.xml file.

Thanks,
Giuseppe

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to