Serializable, Servlet, ServletConfigI2PSnarkServletclass BasicServlet extends HttpServlet
resourceBase Set to replace the context resource base warBase Path allowed for resource in war
| Modifier and Type | Class | Description |
|---|---|---|
static interface |
BasicServlet.HttpContent |
from Jetty HttpContent.java
|
| Modifier and Type | Field | Description |
|---|---|---|
protected I2PAppContext |
_context |
|
protected Log |
_log |
|
protected File |
_resourceBase |
| Constructor | Description |
|---|---|
BasicServlet() |
| Modifier and Type | Method | Description |
|---|---|---|
protected void |
addMimeMapping(String extension,
String type) |
|
protected static String |
addPaths(String base,
String path) |
Simple version of URIUtil.addPaths()
|
protected static String |
decodePath(String path) |
Simple version of URIUtil.decodePath()
|
protected void |
doDelete(HttpServletRequest request,
HttpServletResponse response) |
|
protected void |
doGet(HttpServletRequest request,
HttpServletResponse response) |
|
protected void |
doOptions(HttpServletRequest request,
HttpServletResponse response) |
|
protected void |
doPost(HttpServletRequest request,
HttpServletResponse response) |
|
protected void |
doTrace(HttpServletRequest request,
HttpServletResponse response) |
|
protected static String |
encodePath(String path) |
Simple version of URIUtil.encodePath()
|
BasicServlet.HttpContent |
getContent(String pathInContext) |
get Resource to serve.
|
protected String |
getMimeType(String filename) |
Get the MIME type by filename extension.
|
File |
getResource(String pathInContext) |
get Resource to serve.
|
void |
init(ServletConfig cfg) |
|
protected void |
loadMimeMap(String resourcePath) |
|
protected boolean |
passConditionalHeaders(HttpServletRequest request,
HttpServletResponse response,
BasicServlet.HttpContent content) |
Check modification date headers.
|
protected void |
sendData(HttpServletRequest request,
HttpServletResponse response,
BasicServlet.HttpContent content) |
|
protected void |
setResourceBase(File base) |
Files are served from here
|
protected void |
setWarBase(String base) |
Only paths starting with this in the path are served
|
protected void |
writeHeaders(HttpServletResponse response,
BasicServlet.HttpContent content,
long count) |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, logdoHead, doPut, getLastModified, service, serviceprotected final transient I2PAppContext _context
protected final transient Log _log
protected File _resourceBase
public void init(ServletConfig cfg) throws ServletException
init in interface Servletinit in class GenericServletServletExceptionprotected void setResourceBase(File base) throws UnavailableException
UnavailableExceptionprotected void setWarBase(String base)
public File getResource(String pathInContext)
pathInContext - The path to find a resource for.public BasicServlet.HttpContent getContent(String pathInContext)
pathInContext - The path to find a resource for.protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doGet in class HttpServletServletExceptionIOExceptionprotected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doPost in class HttpServletServletExceptionIOExceptionprotected void doTrace(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doTrace in class HttpServletServletExceptionIOExceptionprotected void doOptions(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doOptions in class HttpServletServletExceptionIOExceptionprotected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doDelete in class HttpServletServletExceptionIOExceptionprotected boolean passConditionalHeaders(HttpServletRequest request, HttpServletResponse response, BasicServlet.HttpContent content) throws IOException
IOExceptionprotected void sendData(HttpServletRequest request, HttpServletResponse response, BasicServlet.HttpContent content) throws IOException
IOExceptionprotected void writeHeaders(HttpServletResponse response, BasicServlet.HttpContent content, long count) throws IOException
IOExceptionprotected void loadMimeMap(String resourcePath)
resourcePath - in the classpath, without ".properties" extensionprotected String getMimeType(String filename)
filename - A file nameprotected static String addPaths(String base, String path)
path - may be nullprotected static String decodePath(String path) throws MalformedURLException
MalformedURLException