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<java.nio.file.Path,ResourceServlet.Resource> cache,
boolean refresh) |
protected |
ResourceServlet(com.google.common.cache.Cache<java.nio.file.Path,ResourceServlet.Resource> cache,
boolean refresh,
boolean cacheOnClient) |
Modifier and Type | Method and Description |
---|---|
protected static java.lang.String |
contentType(java.lang.String name) |
protected void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse rsp) |
protected java.nio.file.attribute.FileTime |
getLastModifiedTime(java.nio.file.Path p) |
protected abstract java.nio.file.Path |
getResourcePath(java.lang.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<java.nio.file.Path,ResourceServlet.Resource> cache, boolean refresh)
protected ResourceServlet(com.google.common.cache.Cache<java.nio.file.Path,ResourceServlet.Resource> cache, boolean refresh, boolean cacheOnClient)
protected static java.lang.String contentType(java.lang.String name)
protected abstract java.nio.file.Path getResourcePath(java.lang.String pathInfo) throws java.io.IOException
pathInfo
- result of HttpServletRequest.getPathInfo()
.java.io.IOException
- if an error occurred resolving the resource.protected java.nio.file.attribute.FileTime getLastModifiedTime(java.nio.file.Path p) throws java.io.IOException
java.io.IOException
protected void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp) throws java.io.IOException
doGet
in class javax.servlet.http.HttpServlet
java.io.IOException