class BasicServlet extends HttpServlet
resourceBase Set to replace the context resource base warBase Path allowed for resource in war
Modifier and Type | Class and Description |
---|---|
static interface |
BasicServlet.HttpContent
from Jetty HttpContent.java
|
Modifier and Type | Field and Description |
---|---|
protected I2PAppContext |
_context |
protected Log |
_log |
protected File |
_resourceBase |
Constructor and Description |
---|
BasicServlet() |
Modifier and Type | Method and 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) |
doHead, doPut, getLastModified, service, service
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
protected final transient I2PAppContext _context
protected final transient Log _log
protected File _resourceBase
public void init(ServletConfig cfg) throws ServletException
init
in interface Servlet
init
in class GenericServlet
ServletException
protected void setResourceBase(File base) throws UnavailableException
UnavailableException
protected 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 HttpServlet
ServletException
IOException
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doPost
in class HttpServlet
ServletException
IOException
protected void doTrace(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doTrace
in class HttpServlet
ServletException
IOException
protected void doOptions(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doOptions
in class HttpServlet
ServletException
IOException
protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doDelete
in class HttpServlet
ServletException
IOException
protected boolean passConditionalHeaders(HttpServletRequest request, HttpServletResponse response, BasicServlet.HttpContent content) throws IOException
IOException
protected void sendData(HttpServletRequest request, HttpServletResponse response, BasicServlet.HttpContent content) throws IOException
IOException
protected void writeHeaders(HttpServletResponse response, BasicServlet.HttpContent content, long count) throws IOException
IOException
protected 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