Tomcat 4.x and servlet mapping.

Alessandro A. Garbagnati

 With Tomcat 3.x, by default the servlet container was set up to allow invoking a servet through a common mapping under the /servlet/ directory.
A servlet could be accessed by simply using an url like this one:
http://[domain]:[port]/[context]/servlet/[servlet full qualified name].
The mapping was set inside the web application descriptor (web.xml), located under $TOMCAT_HOME/conf.

 With Tomcat 4.x the Jakarta developers have decided to stop allowing this by default. The <servlet-mapping> tag that sets this mapping up, has been commented inside the default web application descriptor (web.xml), located under $CATALINA_HOME/conf:

    <!-- The mapping for the invoker servlet -->
 A developer can simply map all the servlet inside the web application descriptor of its own web application (that is highly suggested), or simply uncomment that mapping (that is highly discouraged).
 It is important to notice that the /servlet/ isn't part of Servlet 2.3 specifications so there are no guarantee that the container will support that. So, if the developer decides to uncomment that mapping, the application will loose portabiliy.
About | Sitemap | Contact