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 voiddoGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)protected longgetLastModified(javax.servlet.http.HttpServletRequest request)voidinit()voidsetRoot(java.io.File root)Configures the file systemrootfor 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 systemrootfor this servlet. Ifrootis a directory, files will be served relative to the directory. Ifrootis a file, only this file may be served- Parameters:
root- the file system root.
-
init
public void init() throws javax.servlet.ServletException- Overrides:
initin classjavax.servlet.GenericServlet- Throws:
javax.servlet.ServletException
-
getLastModified
protected long getLastModified(javax.servlet.http.HttpServletRequest request)
- Overrides:
getLastModifiedin classjavax.servlet.http.HttpServlet
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException- Overrides:
doGetin classjavax.servlet.http.HttpServlet- Throws:
java.io.IOException
-
-