public class FileServlet extends BridgeServlet
AttachmentServlet,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
protected static class |
FileServlet.ChainedRange
This implementation of Range parses and combines a number of
FileServlet.FirstLastRanges. |
static class |
FileServlet.DirectoryFunction
The directory as a function.
|
protected static class |
FileServlet.FirstLastRange
Implementation of Range simply stating the first and last chars which are available, perhaps with a maximum too.
|
protected static interface |
FileServlet.Range |
BridgeServlet.QueryParts| Modifier and Type | Field and Description |
|---|---|
(package private) static String |
PROTECTED_FILES |
FILE_PATTERN, MESSAGE_ATTRIBUTEmmbase, retryAfter| Constructor and Description |
|---|
FileServlet() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
canRead(javax.servlet.http.HttpServletRequest req,
File f)
Returns whether the given file can be served out for the given request.
|
protected File |
checkFile(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp) |
protected void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Serves MMBase version information.
|
protected void |
doHead(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp) |
protected void |
doPut(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp) |
protected Map<String,Integer> |
getAssociations()
On default, servlets are not associated with any function.
|
static File |
getDirectory() |
static File |
getFile(String pathInfo,
javax.servlet.ServletResponse res) |
static FileServlet |
getInstance() |
protected long |
getLastModified(javax.servlet.http.HttpServletRequest req)
The idea is that a 'bridge servlet' on default serves 'nodes', and that there could be
defined a 'last modified' time for nodes.
|
protected byte[] |
getListingBytes(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
File directory) |
File |
getMetaFile(File f)
FileServlet supports 'meta' files like Cern HTTPD (and apaches mod_cern_meta).
|
Map<String,String> |
getMetaHeaders(File f)
Returns contents of
getMetaFile(java.io.File) as a Map. |
static String |
getMetaValue(String field,
String value) |
protected FileServlet.ChainedRange |
getRange(javax.servlet.http.HttpServletRequest req,
File file)
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
|
String |
getServletInfo()
Returns information about this servlet.
|
protected static File |
getSessionFile(File f) |
protected boolean |
ignores(String pi) |
void |
init()
Inits lastmodifiedField.
|
protected void |
listing(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
OutputStream o,
File directory) |
static String |
parseMetaValue(String fieldName,
String cd) |
static void |
protectFile(javax.servlet.http.HttpServletRequest req,
File f) |
protected void |
setHeaders(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
File file) |
void |
setMetaHeaders(File f,
Map<String,String> meta)
Sets contents of
getMetaFile(java.io.File) as a Map. |
void |
setMMBase(MMBase mmb)
Sets the mmbase member.
|
protected static void |
stream(FileServlet.ChainedRange range,
InputStream in,
OutputStream out) |
protected void |
stream(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
OutputStream o,
File file) |
desperatelyGetNode, findCloud, getAnonymousCloud, getClassCloud, getCloud, getCloudName, getNode, getServedNode, readQuery, readQuery, readQueryFromRequestURI, readServletPathassociateMapping, checkInited, decRefCount, destroy, getBasePath, getMMBase, getRequestURL, getServletByAssociation, getServletByMapping, getServletMappings, getServletMappingsByAssociation, incRefCount, service, setInitExceptiondoDelete, doOptions, doPost, doTrace, servicestatic final String PROTECTED_FILES
public void init()
throws javax.servlet.ServletException
BridgeServletinit in class BridgeServletjavax.servlet.ServletExceptionpublic void setMMBase(MMBase mmb)
MMBaseServletsetMMBase in interface MMBaseStartersetMMBase in class MMBaseServletpublic String getServletInfo()
MMBaseServletgetServletInfo in interface javax.servlet.ServletgetServletInfo in class MMBaseServletprotected Map<String,Integer> getAssociations()
MMBaseServletgetAssociations in class MMBaseServletpublic static FileServlet getInstance()
public static File getDirectory()
public static void protectFile(javax.servlet.http.HttpServletRequest req,
File f)
throws IOException
IOExceptionprotected boolean canRead(javax.servlet.http.HttpServletRequest req,
File f)
protectFile(javax.servlet.http.HttpServletRequest, java.io.File) to make the file only accessible to the current http session.protected boolean ignores(String pi)
public File getMetaFile(File f)
public Map<String,String> getMetaHeaders(File f)
getMetaFile(java.io.File) as a Map.public void setMetaHeaders(File f, Map<String,String> meta)
getMetaFile(java.io.File) as a Map.protected File checkFile(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException
javax.servlet.ServletExceptionIOExceptionprotected void setHeaders(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
File file)
throws javax.servlet.ServletException,
IOException
javax.servlet.ServletExceptionIOExceptionprotected void doHead(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
doHead in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionIOExceptionprotected void doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
MMBaseServletdoGet in class MMBaseServletjavax.servlet.ServletExceptionIOExceptionprotected FileServlet.ChainedRange getRange(javax.servlet.http.HttpServletRequest req, File file)
null otherwise.protected static void stream(FileServlet.ChainedRange range, InputStream in, OutputStream out) throws IOException
IOExceptionprotected void stream(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
OutputStream o,
File file)
throws IOException
IOExceptionprotected byte[] getListingBytes(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
File directory)
throws IOException
IOExceptionprotected void listing(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
OutputStream o,
File directory)
throws IOException
IOExceptionprotected void doPut(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
doPut in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionIOExceptionprotected long getLastModified(javax.servlet.http.HttpServletRequest req)
BridgeServletgetLastModified in class BridgeServletMMBase 1.9-SNAPSHOT - ${javadoctimestamp}