org.mortbay.http.handler
Class ResourceHandler
java.lang.Object
|
+--org.mortbay.http.handler.NullHandler
|
+--org.mortbay.http.handler.ResourceHandler
- All Implemented Interfaces:
- HttpHandler, LifeCycle
- public class ResourceHandler
- extends NullHandler
Handler to serve files and resources.
Serves files from a given resource URL base and implements
the GET, HEAD, DELETE, OPTIONS, PUT, MOVE methods and the
IfModifiedSince and IfUnmodifiedSince header fields.
A simple memory cache is also provided to reduce file I/O.
HTTP/1.1 ranges are supported.
- Version:
- $Id: ResourceHandler.java,v 1.5 2001/10/07 01:02:02 gregwilkins Exp $
- Author:
- Nuno Preguiça, Greg Wilkins
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ResourceHandler
public ResourceHandler()
- Construct a ResourceHandler.
isDirAllowed
public boolean isDirAllowed()
setDirAllowed
public void setDirAllowed(boolean dirAllowed)
isPutAllowed
public boolean isPutAllowed()
setPutAllowed
public void setPutAllowed(boolean putAllowed)
isDelAllowed
public boolean isDelAllowed()
setDelAllowed
public void setDelAllowed(boolean delAllowed)
isAcceptRanges
public boolean isAcceptRanges()
setAcceptRanges
public void setAcceptRanges(boolean ar)
- Set if the handler accepts range requests.
Default is false;
- Parameters:
ar
- True if the handler should accept ranges
getIndexFiles
public java.util.List getIndexFiles()
setIndexFiles
public void setIndexFiles(java.util.List indexFiles)
addIndexFile
public void addIndexFile(java.lang.String indexFile)
getMaxCachedFiles
public int getMaxCachedFiles()
setMaxCachedFiles
public void setMaxCachedFiles(int maxCachedFiles_)
getMaxCachedFileSize
public int getMaxCachedFileSize()
setMaxCachedFileSize
public void setMaxCachedFileSize(int maxCachedFileSize)
getHandleGeneralOptionsQuery
public boolean getHandleGeneralOptionsQuery()
setHandleGeneralOptionsQuery
public void setHandleGeneralOptionsQuery(boolean b)
start
public void start()
throws java.lang.Exception
- Description copied from interface:
HttpHandler
- Start the handler.
All requests are ignored until start is called.
- Overrides:
start
in class NullHandler
- Following copied from interface:
org.mortbay.util.LifeCycle
- Throws:
java.lang.Exception
- An arbitrary exception may be thrown.
stop
public void stop()
- Description copied from interface:
HttpHandler
- Stop the handler.
New requests are refused and the handler may attempt to wait
for existing requests to complete. The caller may interrupt
the stop call is waiting is taking too long.
- Overrides:
stop
in class NullHandler
destroy
public void destroy()
- Description copied from interface:
HttpHandler
- Destroy the handler.
New requests are refused and all current requests are immediately
terminated.
- Overrides:
destroy
in class NullHandler
handle
public void handle(java.lang.String pathInContext,
java.lang.String pathParams,
HttpRequest request,
HttpResponse response)
throws HttpException,
java.io.IOException
- Description copied from interface:
HttpHandler
- Handle a request.
- Following copied from interface:
org.mortbay.http.HttpHandler
- Parameters:
pathInContext
- The context pathpathParams
- Path parameters such as encoded Session IDrequest
- The requestresponse
- The response.
handleGet
public void handleGet(HttpRequest request,
HttpResponse response,
java.lang.String pathInContext,
Resource resource,
boolean endsWithSlash)
throws java.io.IOException
Copyright © 2000 Mortbay Consulting Pty. Ltd. All Rights Reserved.