org.apache.catalina.servlets
public class DefaultServlet extends HttpServlet
Version: $Revision: 762909 $ $Date: 2009-04-07 21:12:35 +0200 (Tue, 07 Apr 2009) $
Nested Class Summary | |
---|---|
protected class | DefaultServlet.Range |
Field Summary | |
---|---|
protected static int | BUFFER_SIZE
Size of file transfer buffer in bytes. |
protected int | debug
The debugging detail level for this servlet. |
protected String | fileEncoding
File encoding to be used when reading static files. |
protected static ArrayList | FULL
Full range marker. |
protected String | globalXsltFile
Allow customized directory listing per instance. |
protected int | input
The input buffer size to use when serving resources. |
protected boolean | listings
Should we generate directory listings? |
protected String | localXsltFile
Allow customized directory listing per directory. |
protected static String | mimeSeparation
MIME multipart separation string |
protected int | output
The output buffer size to use when serving resources. |
protected String | readmeFile
Allow a readme file to be included. |
protected boolean | readOnly
Read only flag. |
protected ProxyDirContext | resources
Proxy directory context. |
protected static String | RESOURCES_JNDI_NAME
JNDI resources name. |
protected int | sendfileSize
Minimum size for sendfile usage in bytes. |
protected static StringManager | sm
The string manager for this package. |
protected static URLEncoder | urlEncoder
Array containing the safe characters set. |
protected boolean | useAcceptRanges
Should the Accept-Ranges: bytes header be send with static resources? |
Method Summary | |
---|---|
protected boolean | checkIfHeaders(HttpServletRequest request, HttpServletResponse response, ResourceAttributes resourceAttributes)
Check if the conditions specified in the optional If headers are
satisfied.
|
protected boolean | checkIfMatch(HttpServletRequest request, HttpServletResponse response, ResourceAttributes resourceAttributes)
Check if the if-match condition is satisfied.
|
protected boolean | checkIfModifiedSince(HttpServletRequest request, HttpServletResponse response, ResourceAttributes resourceAttributes)
Check if the if-modified-since condition is satisfied.
|
protected boolean | checkIfNoneMatch(HttpServletRequest request, HttpServletResponse response, ResourceAttributes resourceAttributes)
Check if the if-none-match condition is satisfied.
|
protected boolean | checkIfUnmodifiedSince(HttpServletRequest request, HttpServletResponse response, ResourceAttributes resourceAttributes)
Check if the if-unmodified-since condition is satisfied.
|
protected boolean | checkSendfile(HttpServletRequest request, HttpServletResponse response, CacheEntry entry, long length, DefaultServlet.Range range)
Check if sendfile can be used. |
protected void | copy(CacheEntry cacheEntry, InputStream is, ServletOutputStream ostream)
Copy the contents of the specified input stream to the specified
output stream, and ensure that both streams are closed before returning
(even in the face of an exception).
|
protected void | copy(CacheEntry cacheEntry, InputStream is, PrintWriter writer)
Copy the contents of the specified input stream to the specified
output stream, and ensure that both streams are closed before returning
(even in the face of an exception).
|
protected void | copy(CacheEntry cacheEntry, ServletOutputStream ostream, DefaultServlet.Range range)
Copy the contents of the specified input stream to the specified
output stream, and ensure that both streams are closed before returning
(even in the face of an exception).
|
protected void | copy(CacheEntry cacheEntry, PrintWriter writer, DefaultServlet.Range range)
Copy the contents of the specified input stream to the specified
output stream, and ensure that both streams are closed before returning
(even in the face of an exception).
|
protected void | copy(CacheEntry cacheEntry, ServletOutputStream ostream, Iterator ranges, String contentType)
Copy the contents of the specified input stream to the specified
output stream, and ensure that both streams are closed before returning
(even in the face of an exception).
|
protected void | copy(CacheEntry cacheEntry, PrintWriter writer, Iterator ranges, String contentType)
Copy the contents of the specified input stream to the specified
output stream, and ensure that both streams are closed before returning
(even in the face of an exception).
|
protected IOException | copyRange(InputStream istream, ServletOutputStream ostream)
Copy the contents of the specified input stream to the specified
output stream, and ensure that both streams are closed before returning
(even in the face of an exception).
|
protected IOException | copyRange(Reader reader, PrintWriter writer)
Copy the contents of the specified input stream to the specified
output stream, and ensure that both streams are closed before returning
(even in the face of an exception).
|
protected IOException | copyRange(InputStream istream, ServletOutputStream ostream, long start, long end)
Copy the contents of the specified input stream to the specified
output stream, and ensure that both streams are closed before returning
(even in the face of an exception).
|
protected IOException | copyRange(Reader reader, PrintWriter writer, long start, long end)
Copy the contents of the specified input stream to the specified
output stream, and ensure that both streams are closed before returning
(even in the face of an exception).
|
void | destroy()
Finalize this servlet. |
protected void | displaySize(StringBuffer buf, int filesize)
Display the size of a file. |
protected void | doDelete(HttpServletRequest req, HttpServletResponse resp)
Process a POST request for the specified resource.
|
protected void | doGet(HttpServletRequest request, HttpServletResponse response)
Process a GET request for the specified resource.
|
protected void | doHead(HttpServletRequest request, HttpServletResponse response)
Process a HEAD request for the specified resource.
|
protected void | doOptions(HttpServletRequest req, HttpServletResponse resp)
Override default implementation to ensure that TRACE is correctly
handled.
|
protected void | doPost(HttpServletRequest request, HttpServletResponse response)
Process a POST request for the specified resource.
|
protected void | doPut(HttpServletRequest req, HttpServletResponse resp)
Process a POST request for the specified resource.
|
protected File | executePartialPut(HttpServletRequest req, DefaultServlet.Range range, String path)
Handle a partial PUT. |
protected InputStream | findXsltInputStream(DirContext directory)
Return the xsl template inputstream (if possible) |
protected String | getReadme(DirContext directory)
Get the readme file as a string. |
protected String | getRelativePath(HttpServletRequest request)
Return the relative path associated with this servlet.
|
void | init()
Initialize this servlet. |
protected DefaultServlet.Range | parseContentRange(HttpServletRequest request, HttpServletResponse response)
Parse the content-range header.
|
protected ArrayList | parseRange(HttpServletRequest request, HttpServletResponse response, ResourceAttributes resourceAttributes)
Parse the range header.
|
protected InputStream | render(String contextPath, CacheEntry cacheEntry)
Decide which way to render. |
protected InputStream | renderHtml(String contextPath, CacheEntry cacheEntry)
Return an InputStream to an HTML representation of the contents
of this directory.
|
protected String | renderSize(long size)
Render the specified file size (in bytes).
|
protected InputStream | renderXml(String contextPath, CacheEntry cacheEntry, InputStream xsltInputStream)
Return an InputStream to an HTML representation of the contents
of this directory.
|
protected String | rewriteUrl(String path)
URL rewriter.
|
protected void | serveResource(HttpServletRequest request, HttpServletResponse response, boolean content)
Serve the specified resource, optionally including the data content.
|
Parameters: request The servlet request we are processing response The servlet response we are creating resourceAttributes The resource information
Returns: 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
Parameters: request The servlet request we are processing response The servlet response we are creating resourceInfo File object
Returns: boolean true if the resource meets the specified condition, and false if the condition is not satisfied, in which case request processing is stopped
Parameters: request The servlet request we are processing response The servlet response we are creating resourceInfo File object
Returns: boolean true if the resource meets the specified condition, and false if the condition is not satisfied, in which case request processing is stopped
Parameters: request The servlet request we are processing response The servlet response we are creating resourceInfo File object
Returns: boolean true if the resource meets the specified condition, and false if the condition is not satisfied, in which case request processing is stopped
Parameters: request The servlet request we are processing response The servlet response we are creating resourceInfo File object
Returns: boolean true if the resource meets the specified condition, and false if the condition is not satisfied, in which case request processing is stopped
Parameters: resourceInfo The resource information ostream The output stream to write to
Throws: IOException if an input/output error occurs
Parameters: resourceInfo The resource info writer The writer to write to
Throws: IOException if an input/output error occurs
Parameters: resourceInfo The ResourceInfo object ostream The output stream to write to range Range the client wanted to retrieve
Throws: IOException if an input/output error occurs
Parameters: resourceInfo The ResourceInfo object writer The writer to write to range Range the client wanted to retrieve
Throws: IOException if an input/output error occurs
Parameters: resourceInfo The ResourceInfo object ostream The output stream to write to ranges Enumeration of the ranges the client wanted to retrieve contentType Content type of the resource
Throws: IOException if an input/output error occurs
Parameters: resourceInfo The ResourceInfo object writer The writer to write to ranges Enumeration of the ranges the client wanted to retrieve contentType Content type of the resource
Throws: IOException if an input/output error occurs
Parameters: istream The input stream to read from ostream The output stream to write to
Returns: Exception which occurred during processing
Parameters: reader The reader to read from writer The writer to write to
Returns: Exception which occurred during processing
Parameters: istream The input stream to read from ostream The output stream to write to start Start of the range which will be copied end End of the range which will be copied
Returns: Exception which occurred during processing
Parameters: reader The reader to read from writer The writer to write to start Start of the range which will be copied end End of the range which will be copied
Returns: Exception which occurred during processing
Parameters: req The servlet request we are processing resp The servlet response we are creating
Throws: IOException if an input/output error occurs ServletException if a servlet-specified error occurs
Parameters: request The servlet request we are processing response The servlet response we are creating
Throws: IOException if an input/output error occurs ServletException if a servlet-specified error occurs
Parameters: request The servlet request we are processing response The servlet response we are creating
Throws: IOException if an input/output error occurs ServletException if a servlet-specified error occurs
Parameters: req the HttpServletRequest object that contains the request the client made of the servlet resp the HttpServletResponse object that contains the response the servlet returns to the client
Throws: IOException if an input or output error occurs while the servlet is handling the OPTIONS request ServletException if the request for the OPTIONS cannot be handled
Parameters: request The servlet request we are processing response The servlet response we are creating
Throws: IOException if an input/output error occurs ServletException if a servlet-specified error occurs
Parameters: req The servlet request we are processing resp The servlet response we are creating
Throws: IOException if an input/output error occurs ServletException if a servlet-specified error occurs
Parameters: request The servlet request we are processing
Parameters: request The servlet request we are processing response The servlet response we are creating
Returns: Range
Parameters: request The servlet request we are processing response The servlet response we are creating
Returns: Vector of ranges
Parameters: contextPath Context path to which our internal paths are relative
Parameters: size File size (in bytes)
Parameters: contextPath Context path to which our internal paths are relative
Parameters: path Path which has to be rewiten
Parameters: request The servlet request we are processing response The servlet response we are creating content Should the content be included?
Throws: IOException if an input/output error occurs ServletException if a servlet-specified error occurs