Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.mortbay.jetty.servlet
Class Default  view Default download Default.java

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byorg.mortbay.jetty.servlet.Default
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class Default
extends javax.servlet.http.HttpServlet

The default servlet. This servlet, normally mapped to /, provides the handling for static content, OPTION and TRACE methods for the context. The following initParameters are supported:

                                                                      
   acceptRanges     If true, range requests and responses are         
                    supported                                         
                                                                      
   dirAllowed       If true, directory listings are returned if no    
                    welcome file is found. Else 403 Forbidden.        
                                                                      
   putAllowed       If true, the PUT method is allowed                
                                                                      
   delAllowed       If true, the DELETE method is allowed

   redirectWelcome  If true, welcome files are redirected rather than
                    forwarded to.

   minGzipLength    If set to a positive integer, then static content
                    larger than this will be served as gzip content encoded
                    if a matching resource is found ending with ".gz"

  resourceBase      Set to replace the context resource base

  relativeResourceBase    
                    Set with a pathname relative to the base of the
                    servlet context root. Useful for only serving static content out
                    of only specific subdirectories.
 
The MOVE method is allowed if PUT and DELETE are allowed

Version:
$Id: Default.java,v 1.34 2003/11/19 11:37:54 gregwilkins Exp $

Field Summary
private  boolean _acceptRanges
           
private  java.lang.String _AllowString
           
private  boolean _delAllowed
           
private  boolean _dirAllowed
           
private  org.mortbay.http.HttpContext _httpContext
           
private  int _minGzipLength
           
private  boolean _putAllowed
           
private  boolean _redirectWelcomeFiles
           
private  org.mortbay.util.Resource _resourceBase
           
private  ServletHandler _servletHandler
           
private static org.apache.commons.logging.Log log
           
 
Fields inherited from class javax.servlet.http.HttpServlet
 
Fields inherited from class javax.servlet.GenericServlet
 
Constructor Summary
Default()
           
 
Method Summary
private  boolean getInitBoolean(java.lang.String name)
           
private  int getInitInt(java.lang.String name)
           
protected  org.mortbay.util.Resource getResource(java.lang.String pathInContext)
          get Resource to serve.
 void handleDelete(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String pathInContext, org.mortbay.util.Resource resource)
           
 void handleGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String pathInContext, org.mortbay.util.Resource resource, boolean endsWithSlash)
           
 void handleMove(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String pathInContext, org.mortbay.util.Resource resource)
           
 void handleOptions(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void handlePut(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String pathInContext, org.mortbay.util.Resource resource)
           
 void init()
          A convenience method which can be overridden so that there's no need to call super.init(config).
protected  boolean passConditionalHeaders(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.mortbay.util.Resource resource)
           
protected  void sendData(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String pathInContext, org.mortbay.util.Resource resource)
           
protected  void sendDirectory(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.mortbay.util.Resource resource, boolean parent)
           
protected  void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Receives standard HTTP requests from the public service method and dispatches them to the doXXX methods defined in this class.
protected  void writeHeaders(javax.servlet.http.HttpServletResponse response, org.mortbay.util.Resource resource, long count)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, 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

log

private static org.apache.commons.logging.Log log

_httpContext

private org.mortbay.http.HttpContext _httpContext

_servletHandler

private ServletHandler _servletHandler

_AllowString

private java.lang.String _AllowString

_acceptRanges

private boolean _acceptRanges

_dirAllowed

private boolean _dirAllowed

_putAllowed

private boolean _putAllowed

_delAllowed

private boolean _delAllowed

_redirectWelcomeFiles

private boolean _redirectWelcomeFiles

_minGzipLength

private int _minGzipLength

_resourceBase

private org.mortbay.util.Resource _resourceBase
Constructor Detail

Default

public Default()
Method Detail

init

public void init()
          throws javax.servlet.UnavailableException
Description copied from class: javax.servlet.GenericServlet
A convenience method which can be overridden so that there's no need to call super.init(config).

Instead of overriding GenericServlet.init(ServletConfig)>GenericServlet.init(ServletConfig) 55 , simply override this method and it will be called by GenericServlet.init(ServletConfig config). The ServletConfig object can still be retrieved via GenericServlet.getServletConfig()>GenericServlet.getServletConfig() 55 .


getInitBoolean

private boolean getInitBoolean(java.lang.String name)

getInitInt

private int getInitInt(java.lang.String name)

getResource

protected org.mortbay.util.Resource getResource(java.lang.String pathInContext)
                                         throws java.io.IOException
get Resource to serve. Map a path to a resource. The default implementation calls HttpContext.getResource but derived servlets may provide their own mapping.


service

protected void service(javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
                throws javax.servlet.ServletException,
                       java.io.IOException
Description copied from class: javax.servlet.http.HttpServlet
Receives standard HTTP requests from the public service method and dispatches them to the doXXX methods defined in this class. This method is an HTTP-specific version of the Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)>Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) 55 method. There's no need to override this method.


handleGet

public void handleGet(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response,
                      java.lang.String pathInContext,
                      org.mortbay.util.Resource resource,
                      boolean endsWithSlash)
               throws javax.servlet.ServletException,
                      java.io.IOException

handlePut

public void handlePut(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response,
                      java.lang.String pathInContext,
                      org.mortbay.util.Resource resource)
               throws javax.servlet.ServletException,
                      java.io.IOException

handleDelete

public void handleDelete(javax.servlet.http.HttpServletRequest request,
                         javax.servlet.http.HttpServletResponse response,
                         java.lang.String pathInContext,
                         org.mortbay.util.Resource resource)
                  throws javax.servlet.ServletException,
                         java.io.IOException

handleMove

public void handleMove(javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response,
                       java.lang.String pathInContext,
                       org.mortbay.util.Resource resource)
                throws javax.servlet.ServletException,
                       java.io.IOException

handleOptions

public void handleOptions(javax.servlet.http.HttpServletRequest request,
                          javax.servlet.http.HttpServletResponse response)
                   throws java.io.IOException

passConditionalHeaders

protected boolean passConditionalHeaders(javax.servlet.http.HttpServletRequest request,
                                         javax.servlet.http.HttpServletResponse response,
                                         org.mortbay.util.Resource resource)
                                  throws java.io.IOException

sendDirectory

protected void sendDirectory(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response,
                             org.mortbay.util.Resource resource,
                             boolean parent)
                      throws java.io.IOException

sendData

protected void sendData(javax.servlet.http.HttpServletRequest request,
                        javax.servlet.http.HttpServletResponse response,
                        java.lang.String pathInContext,
                        org.mortbay.util.Resource resource)
                 throws java.io.IOException

writeHeaders

protected void writeHeaders(javax.servlet.http.HttpServletResponse response,
                            org.mortbay.util.Resource resource,
                            long count)
                     throws java.io.IOException