org.apache.catalina.servlets
クラス DefaultServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--org.apache.catalina.servlets.DefaultServlet
すべての実装インタフェース:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
直系の既知のサブクラス:
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.

バージョン:
$Revision: 1.39.2.7 $ $Date: 2002/10/08 07:56:04 $
作成者:
Craig R. McClanahan, Remy Maucherat
関連項目:
直列化された形式

内部クラスの概要
protected  class DefaultServlet.ResourceInfo
           
 
フィールドの概要
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 static java.util.TimeZone gmtZone
           
protected static char[] hexadecimal
           
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 java.lang.String RESOURCES_JNDI_NAME
          JNDI resources name.
protected static java.util.BitSet safeCharacters
          Array containing the safe characters set.
protected static StringManager sm
          The string manager for this package.
protected  java.lang.String[] welcomes
          The set of welcome files for this web application
 
コンストラクタの概要
DefaultServlet()
           
 
メソッドの概要
protected  java.lang.String appendParameters(javax.servlet.http.HttpServletRequest request, java.lang.String redirectPath)
          Append the request parameters to the redirection string before calling sendRedirect.
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 displaySize(java.lang.StringBuffer buf, int filesize)
          Display the size of a file.
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.
protected  javax.naming.directory.DirContext getResources()
          Get resources.
 void init()
          Initialize this servlet.
protected  java.lang.String normalize(java.lang.String path)
          Return a context-relative path, beginning with a "/", that represents the canonical version of the specified path after ".." and "." elements are resolved out.
protected  java.util.Vector parseRange(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, DefaultServlet.ResourceInfo resourceInfo)
          Parse the range header.
protected  java.io.InputStream render(java.lang.String contextPath, DefaultServlet.ResourceInfo resourceInfo)
          Return an InputStream to an HTML representation of the contents of this directory.
protected  java.lang.String renderLastModified(long lastModified)
          Render the last modified date and time for the specified timestamp.
protected  java.lang.String renderSize(long size)
          Render the specified file size (in bytes).
protected  java.lang.String rewriteUrl(java.lang.String path)
          URL rewriter.
protected  void serveResource(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean content)
          Serve the specified resource, optionally including the data content.
protected  void showRequestInfo(javax.servlet.http.HttpServletRequest req)
          Show HTTP header information.
 
クラス javax.servlet.http.HttpServlet から継承したメソッド
doOptions, doTrace, getLastModified, service, service
 
クラス javax.servlet.GenericServlet から継承したメソッド
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

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().

gmtZone

protected static final java.util.TimeZone gmtZone

mimeSeparation

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

RESOURCES_JNDI_NAME

protected static final java.lang.String RESOURCES_JNDI_NAME
JNDI resources name.

sm

protected static StringManager sm
The string manager for this package.

safeCharacters

protected static java.util.BitSet safeCharacters
Array containing the safe characters set.

hexadecimal

protected static final char[] hexadecimal
コンストラクタの詳細

DefaultServlet

public DefaultServlet()
メソッドの詳細

destroy

public void destroy()
Finalize this servlet.
オーバーライド:
クラス javax.servlet.GenericServlet 内の destroy

init

public void init()
          throws javax.servlet.ServletException
Initialize this servlet.
オーバーライド:
クラス javax.servlet.GenericServlet 内の init

getResources

protected javax.naming.directory.DirContext getResources()
Get resources. This method will try to retrieve the resources through JNDI first, then in the servlet context if JNDI has failed (it could be disabled). It will return null.
戻り値:
A JNDI DirContext, or null.

showRequestInfo

protected void showRequestInfo(javax.servlet.http.HttpServletRequest req)
Show HTTP header information.

getRelativePath

protected java.lang.String getRelativePath(javax.servlet.http.HttpServletRequest request)
Return the relative path associated with this servlet.
パラメータ:
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.
オーバーライド:
クラス javax.servlet.http.HttpServlet 内の doGet
パラメータ:
request - The servlet request we are processing
response - The servlet response we are creating
例外:
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.
オーバーライド:
クラス javax.servlet.http.HttpServlet 内の doHead
パラメータ:
request - The servlet request we are processing
response - The servlet response we are creating
例外:
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.
オーバーライド:
クラス javax.servlet.http.HttpServlet 内の doPost
パラメータ:
request - The servlet request we are processing
response - The servlet response we are creating
例外:
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.
オーバーライド:
クラス javax.servlet.http.HttpServlet 内の doPut
パラメータ:
request - The servlet request we are processing
response - The servlet response we are creating
例外:
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.
オーバーライド:
クラス javax.servlet.http.HttpServlet 内の doDelete
パラメータ:
request - The servlet request we are processing
response - The servlet response we are creating
例外:
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.
パラメータ:
request - The servlet request we are processing
response - The servlet response we are creating
resourceInfo - File object
戻り値:
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.
パラメータ:
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.
パラメータ:
resourceInfo - File object
strong - True if we want a strong ETag, in which case a checksum of the file has to be calculated

normalize

protected java.lang.String normalize(java.lang.String path)
Return a context-relative path, beginning with a "/", that represents the canonical version of the specified path after ".." and "." elements are resolved out. If the specified path attempts to go outside the boundaries of the current context (i.e. too many ".." path elements are present), return null instead.
パラメータ:
path - Path to be normalized

rewriteUrl

protected java.lang.String rewriteUrl(java.lang.String path)
URL rewriter.
パラメータ:
path - Path which has to be rewiten

displaySize

protected void displaySize(java.lang.StringBuffer buf,
                           int filesize)
Display the size of a file.

serveResource

protected void serveResource(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response,
                             boolean content)
                      throws java.io.IOException,
                             javax.servlet.ServletException
Serve the specified resource, optionally including the data content.
パラメータ:
request - The servlet request we are processing
response - The servlet response we are creating
content - Should the content be included?
例外:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet-specified error occurs

parseRange

protected java.util.Vector parseRange(javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response,
                                      DefaultServlet.ResourceInfo resourceInfo)
                               throws java.io.IOException
Parse the range header.
パラメータ:
request - The servlet request we are processing
response - The servlet response we are creating
戻り値:
Vector of ranges

appendParameters

protected java.lang.String appendParameters(javax.servlet.http.HttpServletRequest request,
                                            java.lang.String redirectPath)
Append the request parameters to the redirection string before calling sendRedirect.

render

protected java.io.InputStream render(java.lang.String contextPath,
                                     DefaultServlet.ResourceInfo resourceInfo)
Return an InputStream to an HTML representation of the contents of this directory.
パラメータ:
contextPath - Context path to which our internal paths are relative

renderLastModified

protected java.lang.String renderLastModified(long lastModified)
Render the last modified date and time for the specified timestamp.
パラメータ:
lastModified - Last modified date and time, in milliseconds since the epoch

renderSize

protected java.lang.String renderSize(long size)
Render the specified file size (in bytes).
パラメータ:
size - File size (in bytes)


Copyright ? 2000-2001 Apache Software Foundation. All Rights Reserved.