Package com.twelvemonkeys.servlet
Class StaticContentServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- com.twelvemonkeys.servlet.HttpServlet
-
- com.twelvemonkeys.servlet.StaticContentServlet
-
- All Implemented Interfaces:
java.io.Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
public final class StaticContentServlet extends HttpServlet
A minimal servlet that can serve static files. Also from outside the web application.- Version:
- $Id: StaticContentServlet.java,v 1.0 12.12.11 15:09 haraldk Exp$
- Author:
- Harald Kuhr, last modified by $Author: haraldk$
- See Also:
setRoot(java.io.File)
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description StaticContentServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
protected long
getLastModified(javax.servlet.http.HttpServletRequest request)
void
init()
void
setRoot(java.io.File root)
Configures the file systemroot
for this servlet.-
Methods inherited from class com.twelvemonkeys.servlet.HttpServlet
init
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, service, service
-
-
-
-
Method Detail
-
setRoot
@InitParam(name="root") public void setRoot(java.io.File root)
Configures the file systemroot
for this servlet. Ifroot
is a directory, files will be served relative to the directory. Ifroot
is a file, only this file may be served- Parameters:
root
- the file system root.
-
init
public void init() throws javax.servlet.ServletException
- Overrides:
init
in classjavax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException
-
getLastModified
protected long getLastModified(javax.servlet.http.HttpServletRequest request)
- Overrides:
getLastModified
in classjavax.servlet.http.HttpServlet
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
- Overrides:
doGet
in classjavax.servlet.http.HttpServlet
- Throws:
java.io.IOException
-
-