public abstract class ResourceServlet
extends javax.servlet.http.HttpServlet
Supports caching, ETags, basic content type detection, and limited gzip compression.
Modifier and Type | Class and Description |
---|---|
static class |
ResourceServlet.Resource |
static class |
ResourceServlet.Weigher |
Modifier | Constructor and Description |
---|---|
protected |
ResourceServlet(com.google.common.cache.Cache<Path,ResourceServlet.Resource> cache,
boolean refresh) |
protected |
ResourceServlet(com.google.common.cache.Cache<Path,ResourceServlet.Resource> cache,
boolean refresh,
boolean cacheOnClient) |
Modifier and Type | Method and Description |
---|---|
protected static String |
contentType(String name) |
protected void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse rsp) |
protected FileTime |
getLastModifiedTime(Path p) |
protected abstract Path |
getResourcePath(String pathInfo)
Get the resource path on the filesystem that should be served for this
request.
|
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
protected ResourceServlet(com.google.common.cache.Cache<Path,ResourceServlet.Resource> cache, boolean refresh)
protected ResourceServlet(com.google.common.cache.Cache<Path,ResourceServlet.Resource> cache, boolean refresh, boolean cacheOnClient)
protected abstract Path getResourcePath(String pathInfo) throws IOException
pathInfo
- result of HttpServletRequest.getPathInfo()
.IOException
- if an error occurred resolving the resource.protected FileTime getLastModifiedTime(Path p) throws IOException
IOException
protected void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp) throws IOException
doGet
in class javax.servlet.http.HttpServlet
IOException