com.mortbay.HTTP.Handler
Class FileHandler
java.lang.Object
|
+--com.mortbay.HTTP.Handler.NullHandler
|
+--com.mortbay.HTTP.Handler.FileHandler
- public class FileHandler
- extends NullHandler
FileHandler
This handler attempts to match files to a file or directory and
return a response set by the MIME type indicated by the file
extension.
The request path is used as a filepath relative to the configured
fileBase.
- Version:
- $Id: FileHandler.java,v 2.29 2000/10/22 22:17:38 gregwilkins Exp $
- Author:
- Greg Wilkins
- See Also:
Interface.HttpHandler
Constructor Summary |
FileHandler(PathMap directoryMap)
Construct a FileHandler |
FileHandler(java.util.Properties properties)
Construct from properties. |
FileHandler(java.lang.String fileBase)
Construct a FileHandler at "/" for the given fileBase |
FileHandler(java.lang.String fileBase,
java.lang.String indexFile)
Construct a FileHandler at the given fileBase and use indexFile
as the default directory return file. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
FileHandler
public FileHandler(java.util.Properties properties)
throws java.io.IOException
- Construct from properties.
- Parameters:
properties
- Passed to setProperties
FileHandler
public FileHandler(java.lang.String fileBase)
- Construct a FileHandler at "/" for the given fileBase
FileHandler
public FileHandler(java.lang.String fileBase,
java.lang.String indexFile)
- Construct a FileHandler at the given fileBase and use indexFile
as the default directory return file.
FileHandler
public FileHandler(PathMap directoryMap)
- Construct a FileHandler
- Parameters:
directoryMap
- PathMap of pathname to directory name
setProperties
public void setProperties(java.util.Properties properties)
throws java.io.IOException
- Configure from Properties.
Properties are assumed to be in the format of a PropertyTree
like:
Indexes : index.html,index.htm
AllowPut : False
AllowDelete : False
AllowDir : True
MaxCachedFiles : 100
MaxCachedFileSize : 8192
FILES.name.PATHS : /pathSpec;/list%
FILES.name.DIRECTORY : /Directory
- Overrides:
- setProperties in class NullHandler
- Parameters:
properties
- Configuration.
isPutAllowed
public boolean isPutAllowed()
setPutAllowed
public void setPutAllowed(boolean putAllowed_)
isDeleteAllowed
public boolean isDeleteAllowed()
setDeleteAllowed
public void setDeleteAllowed(boolean deleteAllowed_)
isDirAllowed
public boolean isDirAllowed()
setDirAllowed
public void setDirAllowed(boolean dirAllowed_)
translate
public java.lang.String translate(java.lang.String path)
- Description copied from interface: HttpHandler
- Translate a path string.
Used by getRealPath method.
- Overrides:
- translate in class NullHandler
- Tags copied from interface: HttpHandler
- Returns:
- the translated path
handle
public void handle(HttpRequest request,
HttpResponse response)
throws java.lang.Exception
- Description copied from interface: HttpHandler
- Constructor
- Overrides:
- handle in class NullHandler
- Tags copied from interface: HttpHandler
- Parameters:
request
- The HTTP requests to be handledresponse
- The HTTP response to be used.