public class Default extends HttpServlet
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
| Constructor and Description |
|---|
Default() |
| Modifier and Type | Method and Description |
|---|---|
protected Resource |
getResource(java.lang.String pathInContext)
get Resource to serve.
|
void |
handleDelete(HttpServletRequest request,
HttpServletResponse response,
java.lang.String pathInContext,
Resource resource) |
void |
handleGet(HttpServletRequest request,
HttpServletResponse response,
java.lang.String pathInContext,
Resource resource,
boolean endsWithSlash) |
void |
handleMove(HttpServletRequest request,
HttpServletResponse response,
java.lang.String pathInContext,
Resource resource) |
void |
handleOptions(HttpServletRequest request,
HttpServletResponse response) |
void |
handlePut(HttpServletRequest request,
HttpServletResponse response,
java.lang.String pathInContext,
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(HttpServletRequest request,
HttpServletResponse response,
Resource resource) |
protected void |
sendData(HttpServletRequest request,
HttpServletResponse response,
java.lang.String pathInContext,
Resource resource) |
protected void |
sendDirectory(HttpServletRequest request,
HttpServletResponse response,
Resource resource,
boolean parent) |
protected void |
service(HttpServletRequest request,
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(HttpServletResponse response,
Resource resource,
long count) |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, servicedestroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, logpublic void init()
throws UnavailableException
GenericServletsuper.init(config).
Instead of overriding GenericServlet.init(ServletConfig), simply override
this method and it will be called by
GenericServlet.init(ServletConfig config).
The ServletConfig object can still be retrieved via GenericServlet.getServletConfig().
init in class GenericServletUnavailableExceptionprotected Resource getResource(java.lang.String pathInContext) throws java.io.IOException
pathInContext - The path to find a resource for.java.io.IOExceptionprotected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException
HttpServletservice 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) method. There's no
need to override this method.service in class HttpServletrequest - the HttpServletRequest object that
contains the request the client made of the servletresponse - the HttpServletResponse object that
contains the response the servlet returns to the clientServletException - if the HTTP request
cannot be handledjava.io.IOException - if an input or output error occurs
while the servlet is handling the HTTP requestServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)public void handleGet(HttpServletRequest request, HttpServletResponse response, java.lang.String pathInContext, Resource resource, boolean endsWithSlash) throws ServletException, java.io.IOException
ServletExceptionjava.io.IOExceptionpublic void handlePut(HttpServletRequest request, HttpServletResponse response, java.lang.String pathInContext, Resource resource) throws ServletException, java.io.IOException
ServletExceptionjava.io.IOExceptionpublic void handleDelete(HttpServletRequest request, HttpServletResponse response, java.lang.String pathInContext, Resource resource) throws ServletException, java.io.IOException
ServletExceptionjava.io.IOExceptionpublic void handleMove(HttpServletRequest request, HttpServletResponse response, java.lang.String pathInContext, Resource resource) throws ServletException, java.io.IOException
ServletExceptionjava.io.IOExceptionpublic void handleOptions(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException
java.io.IOExceptionprotected boolean passConditionalHeaders(HttpServletRequest request, HttpServletResponse response, Resource resource) throws java.io.IOException
java.io.IOExceptionprotected void sendDirectory(HttpServletRequest request, HttpServletResponse response, Resource resource, boolean parent) throws java.io.IOException
java.io.IOExceptionprotected void sendData(HttpServletRequest request, HttpServletResponse response, java.lang.String pathInContext, Resource resource) throws java.io.IOException
java.io.IOExceptionprotected void writeHeaders(HttpServletResponse response, Resource resource, long count) throws java.io.IOException
java.io.IOExceptionCopyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.