Overview

Introduction

The purpose of the Default Servlet is to serve
static resources of a web application in response to client requests.
As the name implies, it is generally configured as the "default"
servlet for a web application, by being mapped to a URL pattern "/".

External Specifications

The following external specifications have provisions which
partially define the correct behavior of the default servlet:

Implementation Requirements

The implementation of this functionality shall conform to the
following requirements:

Must be implemented as a servlet.

Must support configurable parameters for debugging detail level,
input buffer size, output buffer size, whether or not to produce
directory listings when no welcome file is present, and whether or not
modifications are supported via DELETE and PUT.

Dependencies

Environmental Dependencies

The following environmental dependencies must be met in order for
the default servlet to operate correctly:

The default servlet must be registered in the application deployment
descriptor (or the default deployment descriptor in file
$CATALINA_BASE/conf/web.xml) using a "default servlet"
servlet mapping, signified by URL pattern "/".

Container Dependencies

Correct operation of the default servlet depends on the following
specific features of the surrounding container:

The container shall provide a servlet context attribute that
lists the welcome file names that have been defined for this
web application.

The container shall provide a servlet context attribute that
contains a javax.naming.directory.DirContext
implementation representing the static resources of this
web application.

Functionality

Initialization Functionality

The following processing must be performed when the init()
method of the default servlet is called:

Process and sanity check configuration parameters.

Per-Request Functionality

For all HTTP request methods, the resource path is determined from
the path information provided to this request, either as request attribute
javax.servlet.include.path_info (for a request dispatcher
access to a static resource) or by calling
request.getPathInfo() directly.

On each HTTP DELETE request processed by this servlet, the following
processing shall be performed:

If modifications to the static resources are not allowed (set by a
configuration parameter), return HTTP status 403 (forbidden).

If an attempt is made to delete a resource from /META-INF
or /WEB-INF, return HTTP status 403 (forbidden).

If the requested resource does not exist, return HTTP status 404
(not found)