com.arsdigita.acs
Class Tomcat32DefaultServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--com.arsdigita.acs.Tomcat32DefaultServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class Tomcat32DefaultServlet
extends javax.servlet.http.HttpServlet

Default servlet for use with Tomcat 3.2, called by the RequestProcessor for serving static content (.html, .gif, .jpeg, .txt, etc.)

Previous versions of Tomcat, like 3.1, had a default servlet, class org.apache.tomcat.servlets.DefaultServlet, that could be explicitly published in web.xml as "default" and would handle setting the the Content-Type for and serving static content; displaying directory listings; and displaying 404 error messages when there's just no file. Tomcat 3.2 doesn't have this. It has two separate servlets, "tomcat.fileHandler" and "tomcat.dirHandler", for serving static content and directory listings. These servlets are internal to Tomcat, though, and are not public classes. Rather, they are called from the StaticInterceptor.

Tomcat does not expect us to put a servlet on "/" as we do with RequestProcessor and then call the static-content service routines explicitly. But that's exactly what we need to do. So this servlet will call the right internal servlets in Tomcat for serving static content, and acts as a replacement for the no-longer-pertinent DefaultServlet.

To use this servlet, publish it as "default" in WEB-INF/web.xml:

 <servlet>
    default
    com.arsdigita.acs.Tomcat32DefaultServlet
 
 

See Also:
Serialized Form

Constructor Summary
Tomcat32DefaultServlet()
           
 
Method Summary
 void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Forwards to Tomcat's internal servlets for handling static file and dir requests.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tomcat32DefaultServlet

public Tomcat32DefaultServlet()
Method Detail

service

public void service(javax.servlet.http.HttpServletRequest req,
                    javax.servlet.http.HttpServletResponse resp)
             throws javax.servlet.ServletException
Forwards to Tomcat's internal servlets for handling static file and dir requests.
Overrides:
service in class javax.servlet.http.HttpServlet