org.apache.catalina.servlets
Class DefaultServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--org.apache.catalina.servlets.DefaultServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
WebdavServlet

public class DefaultServlet
extends javax.servlet.http.HttpServlet

The default resource-serving servlet for most web applications, used to serve static resources such as HTML pages and images.

Version:
$Revision: 1.11 $ $Date: 2000/10/17 19:45:27 $
Author:
Craig R. McClanahan, Remy Maucherat
See Also:
Serialized Form

Inner Class Summary
protected  class DefaultServlet.ResourceInfo
           
 
Field Summary
protected  int debug
          The debugging detail level for this servlet.
protected static java.text.SimpleDateFormat[] formats
          The set of SimpleDateFormat formats to use in getDateHeader().
protected  int input
          The input buffer size to use when serving resources.
protected  boolean listings
          Should we generate directory listings when no welcome file is present?
protected static MD5Encoder md5Encoder
          The MD5 helper object for this class.
protected static java.security.MessageDigest md5Helper
          MD5 message digest provider.
protected static java.lang.String mimeSeparation
          MIME multipart separation string
protected  int output
          The output buffer size to use when serving resources.
protected  boolean readOnly
          Read only flag.
protected static StringManager sm
          The string manager for this package.
protected  java.lang.String[] welcomes
          The set of welcome files for this web application
 
Constructor Summary
DefaultServlet()
           
 
Method Summary
protected  boolean checkIfHeaders(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, DefaultServlet.ResourceInfo resourceInfo)
          Check if the conditions specified in the optional If headers are satisfied.
 void destroy()
          Finalize this servlet.
protected  void doDelete(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Process a POST request for the specified resource.
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process a GET request for the specified resource.
protected  void doHead(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process a HEAD request for the specified resource.
protected  void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process a POST request for the specified resource.
protected  void doPut(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Process a POST request for the specified resource.
protected  java.lang.String getETag(DefaultServlet.ResourceInfo resourceInfo, boolean strong)
          Get the ETag associated with a file.
protected  java.lang.String getETagValue(DefaultServlet.ResourceInfo resourceInfo, boolean strong)
          Get the ETag value associated with a file.
protected  java.lang.String getRelativePath(javax.servlet.http.HttpServletRequest request)
          Return the relative path associated with this servlet.
 void init()
          Initialize this servlet.
 
Methods inherited from class javax.servlet.http.HttpServlet
doOptions, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

protected int debug
The debugging detail level for this servlet.

input

protected int input
The input buffer size to use when serving resources.

listings

protected boolean listings
Should we generate directory listings when no welcome file is present?

readOnly

protected boolean readOnly
Read only flag. By default, it's set to true.

output

protected int output
The output buffer size to use when serving resources.

welcomes

protected java.lang.String[] welcomes
The set of welcome files for this web application

md5Helper

protected static java.security.MessageDigest md5Helper
MD5 message digest provider.

md5Encoder

protected static final MD5Encoder md5Encoder
The MD5 helper object for this class.

formats

protected static final java.text.SimpleDateFormat[] formats
The set of SimpleDateFormat formats to use in getDateHeader().

mimeSeparation

protected static final java.lang.String mimeSeparation
MIME multipart separation string

sm

protected static StringManager sm
The string manager for this package.
Constructor Detail

DefaultServlet

public DefaultServlet()
Method Detail

destroy

public void destroy()
Finalize this servlet.
Overrides:
destroy in class javax.servlet.GenericServlet

init

public void init()
          throws javax.servlet.ServletException
Initialize this servlet.
Overrides:
init in class javax.servlet.GenericServlet

getRelativePath

protected java.lang.String getRelativePath(javax.servlet.http.HttpServletRequest request)
Return the relative path associated with this servlet.
Parameters:
request - The servlet request we are processing

doGet

protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws java.io.IOException,
                     javax.servlet.ServletException
Process a GET request for the specified resource.
Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet-specified error occurs

doHead

protected void doHead(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws java.io.IOException,
                      javax.servlet.ServletException
Process a HEAD request for the specified resource.
Overrides:
doHead in class javax.servlet.http.HttpServlet
Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet-specified error occurs

doPost

protected void doPost(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws java.io.IOException,
                      javax.servlet.ServletException
Process a POST request for the specified resource.
Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet-specified error occurs

doPut

protected void doPut(javax.servlet.http.HttpServletRequest req,
                     javax.servlet.http.HttpServletResponse resp)
              throws javax.servlet.ServletException,
                     java.io.IOException
Process a POST request for the specified resource.
Overrides:
doPut in class javax.servlet.http.HttpServlet
Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet-specified error occurs

doDelete

protected void doDelete(javax.servlet.http.HttpServletRequest req,
                        javax.servlet.http.HttpServletResponse resp)
                 throws javax.servlet.ServletException,
                        java.io.IOException
Process a POST request for the specified resource.
Overrides:
doDelete in class javax.servlet.http.HttpServlet
Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet-specified error occurs

checkIfHeaders

protected boolean checkIfHeaders(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response,
                                 DefaultServlet.ResourceInfo resourceInfo)
                          throws java.io.IOException
Check if the conditions specified in the optional If headers are satisfied.
Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
resourceInfo - File object
Returns:
boolean true if the resource meets all the specified conditions, and false if any of the conditions is not satisfied, in which case request processing is stopped

getETagValue

protected java.lang.String getETagValue(DefaultServlet.ResourceInfo resourceInfo,
                                        boolean strong)
Get the ETag value associated with a file.
Parameters:
resourceInfo - File object
strong - True if we want a strong ETag, in which case a checksum of the file has to be calculated

getETag

protected java.lang.String getETag(DefaultServlet.ResourceInfo resourceInfo,
                                   boolean strong)
Get the ETag associated with a file.
Parameters:
resourceInfo - File object
strong - True if we want a strong ETag, in which case a checksum of the file has to be calculated


Copyright © 2000 Apache Software Foundation. All Rights Reserved.