org.mortbay.jetty.servlet

Class Default

public class Default extends 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.51 2006/10/08 14:13:18 gregwilkins Exp $

Author: Greg Wilkins (gregw)

Method Summary
protected ResourcegetResource(String pathInContext)
get Resource to serve.
voidhandleDelete(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource)
voidhandleGet(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource, boolean endsWithSlash)
voidhandleMove(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource)
voidhandleOptions(HttpServletRequest request, HttpServletResponse response)
voidhandlePut(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource)
voidinit()
protected booleanpassConditionalHeaders(HttpServletRequest request, HttpServletResponse response, Resource resource)
protected voidsendData(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource)
protected voidsendDirectory(HttpServletRequest request, HttpServletResponse response, Resource resource, boolean parent)
protected voidservice(HttpServletRequest request, HttpServletResponse response)
protected voidwriteHeaders(HttpServletResponse response, Resource resource, long count)

Method Detail

getResource

protected Resource getResource(String pathInContext)
get Resource to serve. Map a path to a resource. The default implementation calls HttpContext.getResource but derived servlets may provide their own mapping.

Parameters: pathInContext The path to find a resource for.

Returns: The resource to serve.

handleDelete

public void handleDelete(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource)

handleGet

public void handleGet(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource, boolean endsWithSlash)

handleMove

public void handleMove(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource)

handleOptions

public void handleOptions(HttpServletRequest request, HttpServletResponse response)

handlePut

public void handlePut(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource)

init

public void init()

passConditionalHeaders

protected boolean passConditionalHeaders(HttpServletRequest request, HttpServletResponse response, Resource resource)

sendData

protected void sendData(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource)

sendDirectory

protected void sendDirectory(HttpServletRequest request, HttpServletResponse response, Resource resource, boolean parent)

service

protected void service(HttpServletRequest request, HttpServletResponse response)

writeHeaders

protected void writeHeaders(HttpServletResponse response, Resource resource, long count)
Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.