source: nutchez-0.1/tomcat/webapps/docs/funcspecs/printer/fs-default.html @ 180

Last change on this file since 180 was 66, checked in by waue, 16 years ago

NutchEz - an easy way to nutch

File size: 12.9 KB
Line 
1<html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Catalina Functional Specifications - Default Servlet</title><meta value="Craig McClanahan" name="author"><meta value="craigmcc@apache.org" name="email"></head><body vlink="#525D76" alink="#525D76" link="#525D76" text="#000000" bgcolor="#ffffff"><table cellspacing="0" width="100%" border="0"><!--PAGE HEADER--><tr><td><!--PROJECT LOGO--><a href="http://tomcat.apache.org/"><img border="0" alt="
2      Catalina Functional Specifications
3    " align="right" src="../../../images/tomcat.gif"></a></td><td><font face="arial,helvetica,sanserif"><h1>Apache Tomcat 6.0</h1></font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img border="0" alt="Apache Logo" align="right" src="../../../images/asf-logo.gif"></a></td></tr></table><table cellspacing="4" width="100%" border="0"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade></td></tr><tr><!--RIGHT SIDE MAIN BODY--><td align="left" valign="top" width="80%"><table cellspacing="4" width="100%" border="0"><tr><td valign="top" align="left"><h1>Catalina Functional Specifications</h1><h2>Default Servlet</h2></td><td nowrap="true" valign="top" align="right"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../../../images/void.gif"></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Overview"><strong>Overview</strong></a></font></td></tr><tr><td><blockquote>
4
5
6  <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote>
7
8    <p>The purpose of the <strong>Default Servlet</strong> is to serve
9    static resources of a web application in response to client requests.
10    As the name implies, it is generally configured as the "default"
11    servlet for a web application, by being mapped to a URL pattern "/".</p>
12
13  </blockquote></td></tr></table>
14
15
16  <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="External Specifications"><strong>External Specifications</strong></a></font></td></tr><tr><td><blockquote>
17
18    <p>The following external specifications have provisions which
19    partially define the correct behavior of the default servlet:</p>
20    <ul>
21    <li><a href="http://java.sun.com/products/servlet/download.html">
22        Servlet Specification</a> (Version 2.3 PFD2)</li>
23    <li><a href="http://www.rfc-editor.org/rfc/rfc2046.txt">Multipurpose
24        Internet Mail Extensions (MIME) Part Two: Media Types</a></li>
25    <li><a href="http://www.rfc-editor.org/rfc/rfc2616.txt">Hypertext
26        Transfer Protocol -- HTTP/1.1</a></li>
27    </ul>
28
29  </blockquote></td></tr></table>
30
31
32  <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Implementation Requirements"><strong>Implementation Requirements</strong></a></font></td></tr><tr><td><blockquote>
33
34    <p>The implementation of this functionality shall conform to the
35    following requirements:</p>
36    <ul>
37    <li>Must be implemented as a servlet.</li>
38    <li>Must support configurable parameters for debugging detail level,
39        input buffer size, output buffer size, whether or not to produce
40        directory listings when no welcome file is present, and whether or not
41        modifications are supported via DELETE and PUT.</li>
42    <li>Log debugging and operational messages (suitably internationalized)
43        via the <code>getServletContext().log()</code> method.</li>
44    </ul>
45
46  </blockquote></td></tr></table>
47
48
49</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Dependencies"><strong>Dependencies</strong></a></font></td></tr><tr><td><blockquote>
50
51
52  <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Environmental Dependencies"><strong>Environmental Dependencies</strong></a></font></td></tr><tr><td><blockquote>
53
54    <p>The following environmental dependencies must be met in order for
55    the default servlet to operate correctly:</p>
56    <ul>
57    <li>The default servlet must be registered in the application deployment
58        descriptor (or the default deployment descriptor in file
59        <code>$CATALINA_BASE/conf/web.xml</code>) using a "default servlet"
60        servlet mapping, signified by URL pattern "/".</li>
61    </ul>
62
63  </blockquote></td></tr></table>
64
65
66  <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Container Dependencies"><strong>Container Dependencies</strong></a></font></td></tr><tr><td><blockquote>
67
68    <p>Correct operation of the default servlet depends on the following
69    specific features of the surrounding container:</p>
70    <ul>
71    <li>The container shall provide a servlet context attribute that
72        lists the welcome file names that have been defined for this
73        web application.</li>
74    <li>The container shall provide a servlet context attribute that
75        contains a <code>javax.naming.directory.DirContext</code>
76        implementation representing the static resources of this
77        web application.</li>
78    </ul>
79
80  </blockquote></td></tr></table>
81
82
83</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Functionality"><strong>Functionality</strong></a></font></td></tr><tr><td><blockquote>
84
85
86  <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Initialization Functionality"><strong>Initialization Functionality</strong></a></font></td></tr><tr><td><blockquote>
87
88    <p>The following processing must be performed when the <code>init()</code>
89    method of the invoker servlet is called:</p>
90    <ul>
91    <li>Process and sanity check configuration parameters.</li>
92    </ul>
93
94  </blockquote></td></tr></table>
95
96
97  <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Per-Request Functionality"><strong>Per-Request Functionality</strong></a></font></td></tr><tr><td><blockquote>
98
99
100    <p>For all HTTP request methods, the resource path is determined from
101    the path information provided to this request, either as request attribute
102    <code>javax.servlet.include.path_info</code> (for a request dispatcher
103    access to a static resource) or by calling
104    <code>request.getPathInfo()</code> directly.</p>
105
106    <p>On each HTTP DELETE request processed by this servlet, the following
107    processing shall be performed:</p>
108    <ul>
109    <li>If modifications to the static resources are not allowed (set by a
110        configuration parameter), return HTTP status 403 (forbidden).</li>
111    <li>If an attempt is made to delete a resource from <code>/META-INF</code>
112        or <code>/WEB-INF</code>, return HTTP status 403 (forbidden).</li>
113    <li>If the requested resource does not exist, return HTTP status 404
114        (not found)</li>
115    <li>Unbind the resource from the directory context containing the
116        static resources for this web application.  If successful, return
117        HTTP status 204 (no content).  Otherwise, return HTTP status 405
118        (method not allowed).</li>
119    </ul>
120
121
122    <p>On each HTTP GET request processed by this servlet, the following
123    processing shall be performed:</p>
124    <ul>
125    <li>If the request is for a resource under <code>/META-INF</code> or
126        <code>/WEB-INF</code>, return HTTP status 404 (not found).</li>
127    <li>If the requested resource does not exist, return HTTP status 404
128        (not found).</li>
129    <li>If the requested resource is not a directory, but the resource
130        path ends in "/" or "\", return HTTP status 404 (not found).</li>
131    <li>If the requested resource is a directory:
132        <ul>
133        <li>If the request path does not end with "/", redirect to a
134            corresponding path with "/" appended so that relative references
135            in welcome files are resolved correctly.</li>
136        <li>If one of the specified welcome files exists, redirect to the
137            path for that welcome file so that it will be served explicitly.
138            </li>
139        </ul></li>
140    <li>If the request being processed contains an <code>If-Range</code>
141        header, perform the processing described in the HTTP/1.1 specification
142        to determine whether the client's information is up to date.</li>
143    <li>Determine the content type of the response, by looking up the
144        corresponding MIME type in our servlet context.</li>
145    <li>If the requested resource is a directory:
146        <ul>
147        <li>If directory listings are suppressed, return HTTP status 404
148            (not found).</li>
149        <li>Set the content type to <code>text/html</code>.</li>
150        </ul></li>
151    <li>Determine the range(s) to be returned, based on the existence of
152        any <code>If-Range</code> and <code>Range</code> headers.</li>
153    <li>If the requested resource is a directory, include an <code>ETag</code>
154        header in the response, with the value calculated based on the content
155        of the directory.</li>
156    <li>Include a <code>Last-Modified</code> header in the response documenting
157        the date/time that the resource was last modified.</li>
158    <li>Unless we are processing a HEAD request, include the appropriate
159        content (or content ranges) in the response.</li>
160    </ul>
161
162    <p>On each HTTP HEAD request processed by this servlet, the following
163    processing shall be performed:</p>
164    <ul>
165    <li>Processed identically to an HTTP GET request, except that the data
166        content is not transmitted after the headers.</li>
167    </ul>
168
169    <p>On each HTTP POST request processed by this servlet, the following
170    processing shall be performed:</p>
171    <ul>
172    <li>Processed identically to an HTTP GET request.</li>
173    </ul>
174
175
176    <p>On each HTTP PUT request processed by this servlet, the following
177    processing shall be perfomred:</p>
178    <ul>
179    <li>If modifications to the static resources are not allowed (set by a
180        configuration parameter), return HTTP status 403 (forbidden).</li>
181    <li>If an attempt is made to delete a resource from <code>/META-INF</code>
182        or <code>/WEB-INF</code>, return HTTP status 403 (forbidden).</li>
183    <li>Create a new resource from the body of this request.</li>
184    <li>Bind or rebind the specified path to the new resource (depending on
185        whether it currently exists or not).  Return HTTP status as follows:
186        <ul>
187        <li>If binding was unsuccessful, return HTTP status 409 (conflict).
188            </li>
189        <li>If binding was successful and the resource did not previously
190            exist, return HTTP status 201 (created).</li>
191        <li>If binding was successful and the resource previously existed,
192            return HTTP status 204 (no content).</li>
193        </ul></li>
194    </ul>
195
196  </blockquote></td></tr></table>
197
198
199  <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Finalization Functionality"><strong>Finalization Functionality</strong></a></font></td></tr><tr><td><blockquote>
200
201    <p>No specific processing is required when the <code>destroy()</code>
202    method is called:</p>
203
204  </blockquote></td></tr></table>
205
206
207</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Testable Assertions"><strong>Testable Assertions</strong></a></font></td></tr><tr><td><blockquote>
208
209  <p>In addition the the assertions implied by the functionality requirements
210  listed above, the following additional assertions shall be tested to
211  validate the behavior of the invoker servlet:</p>
212  <ul>
213  <li>Requests for resources that do not exist in the web application must
214      return HTTP status 404 (not found).</li>
215  <li>The default servlet must operate identically for web applications that
216      are run out of a WAR file directly, or from an unpacked directory
217      structure.</li>
218  <li>If the web application is running out of an unpacked directory
219      structure, the default servlet must recognize cases where the resource
220      has been updated through external means.</li>
221  </ul>
222
223</blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font size="-1" color="#525D76"><em>
224        Copyright &copy; 1999-2008, Apache Software Foundation
225        </em></font></div></td></tr></table></body></html>
Note: See TracBrowser for help on using the repository browser.