|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.mmbase.servlet.MMBaseServlet
org.mmbase.servlet.BridgeServlet
org.mmbase.servlet.FileServlet
public class FileServlet
Straight-forward filter which can serve files from one directory (the directory 'files' in the mmbase 'datadir') outside the web application root.
AttachmentServlet,
Serialized Form| Nested Class Summary | |
|---|---|
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
|
| Nested classes/interfaces inherited from class org.mmbase.servlet.BridgeServlet |
|---|
BridgeServlet.QueryParts |
| Field Summary | |
|---|---|
(package private) static String |
PROTECTED_FILES
|
| Fields inherited from class org.mmbase.servlet.BridgeServlet |
|---|
FILE_PATTERN, MESSAGE_ATTRIBUTE |
| Fields inherited from class org.mmbase.servlet.MMBaseServlet |
|---|
mmbase, retryAfter |
| Constructor Summary | |
|---|---|
FileServlet()
|
|
| Method Summary | |
|---|---|
protected boolean |
canRead(HttpServletRequest req,
File f)
Returns whether the given file can be served out for the given request. |
protected File |
checkFile(HttpServletRequest req,
HttpServletResponse resp)
|
protected void |
doGet(HttpServletRequest req,
HttpServletResponse resp)
Serves MMBase version information. |
protected void |
doHead(HttpServletRequest req,
HttpServletResponse resp)
|
protected void |
doPut(HttpServletRequest req,
HttpServletResponse resp)
|
protected Map<String,Integer> |
getAssociations()
On default, servlets are not associated with any function. |
static File |
getDirectory()
|
static File |
getFile(String pathInfo,
ServletResponse res)
|
static FileServlet |
getInstance()
|
protected long |
getLastModified(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(HttpServletRequest req,
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. |
protected FileServlet.ChainedRange |
getRange(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(HttpServletRequest req,
HttpServletResponse resp,
OutputStream o,
File directory)
|
static void |
protectFile(HttpServletRequest req,
File f)
|
protected void |
setHeaders(HttpServletRequest req,
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(HttpServletRequest req,
HttpServletResponse resp,
OutputStream o,
File file)
|
| Methods inherited from class org.mmbase.servlet.BridgeServlet |
|---|
desperatelyGetNode, findCloud, getAnonymousCloud, getClassCloud, getCloud, getCloudName, getNode, getServedNode, readQuery, readQuery, readQueryFromRequestURI, readServletPath |
| Methods inherited from class org.mmbase.servlet.MMBaseServlet |
|---|
associateMapping, checkInited, decRefCount, destroy, getBasePath, getMMBase, getRequestURL, getServletByAssociation, getServletByMapping, getServletMappings, getServletMappingsByAssociation, incRefCount, service, setInitException |
| Methods inherited from class javax.servlet.http.HttpServlet |
|---|
doDelete, doOptions, doPost, doTrace, service |
| Methods inherited from class javax.servlet.GenericServlet |
|---|
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static final String PROTECTED_FILES
| Constructor Detail |
|---|
public FileServlet()
| Method Detail |
|---|
public void init()
throws ServletException
BridgeServlet
init in class BridgeServletServletExceptionpublic void setMMBase(MMBase mmb)
MMBaseServlet
setMMBase in interface MMBaseStartersetMMBase in class MMBaseServletpublic String getServletInfo()
MMBaseServlet
getServletInfo in interface ServletgetServletInfo in class MMBaseServletprotected Map<String,Integer> getAssociations()
MMBaseServlet
getAssociations in class MMBaseServletpublic static FileServlet getInstance()
public static File getDirectory()
public static File getFile(String pathInfo,
ServletResponse res)
protected static File getSessionFile(File f)
public static void protectFile(HttpServletRequest req,
File f)
throws IOException
IOException
protected boolean canRead(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(HttpServletRequest req,
HttpServletResponse resp)
throws ServletException,
IOException
ServletException
IOException
protected void setHeaders(HttpServletRequest req,
HttpServletResponse resp,
File file)
throws ServletException,
IOException
ServletException
IOException
protected void doHead(HttpServletRequest req,
HttpServletResponse resp)
throws ServletException,
IOException
doHead in class HttpServletServletException
IOException
protected void doGet(HttpServletRequest req,
HttpServletResponse resp)
throws ServletException,
IOException
MMBaseServlet
doGet in class MMBaseServletServletException
IOException
protected FileServlet.ChainedRange getRange(HttpServletRequest req,
File file)
null otherwise.
protected static void stream(FileServlet.ChainedRange range,
InputStream in,
OutputStream out)
throws IOException
IOException
protected void stream(HttpServletRequest req,
HttpServletResponse resp,
OutputStream o,
File file)
throws IOException
IOException
protected byte[] getListingBytes(HttpServletRequest req,
HttpServletResponse resp,
File directory)
throws IOException
IOException
protected void listing(HttpServletRequest req,
HttpServletResponse resp,
OutputStream o,
File directory)
throws IOException
IOException
protected void doPut(HttpServletRequest req,
HttpServletResponse resp)
throws ServletException,
IOException
doPut in class HttpServletServletException
IOExceptionprotected long getLastModified(HttpServletRequest req)
BridgeServlet
getLastModified in class BridgeServlet
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||