|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.mortbay.http.handler.AbstractHttpHandler | +--org.mortbay.http.handler.ResourceHandler
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.
Constructor Summary | |
ResourceHandler()
Construct a ResourceHandler. |
Method Summary | |
java.lang.String[] |
getAllowedMethods()
|
java.lang.String |
getAllowedString()
|
int |
getMinGzipLength()
Get minimum content length for GZIP encoding. |
boolean |
getRedirectWelcome()
|
void |
handle(java.lang.String pathInContext,
java.lang.String pathParams,
HttpRequest request,
HttpResponse response)
Handle a request. |
void |
handleGet(HttpRequest request,
HttpResponse response,
java.lang.String pathInContext,
java.lang.String pathParams,
Resource resource)
|
boolean |
isAcceptRanges()
|
boolean |
isDirAllowed()
|
boolean |
isMethodAllowed(java.lang.String method)
|
void |
sendData(HttpRequest request,
HttpResponse response,
java.lang.String pathInContext,
Resource resource,
boolean writeHeaders)
|
void |
setAcceptRanges(boolean ar)
Set if the handler accepts range requests. |
void |
setAllowedMethods(java.lang.String[] methods)
|
void |
setDirAllowed(boolean dirAllowed)
|
void |
setMinGzipLength(int minGzipLength)
Set minimum content length for GZIP encoding. |
void |
setRedirectWelcome(boolean redirectWelcome)
|
void |
start()
Start the LifeCycle. |
void |
stop()
Stop the LifeCycle. |
void |
writeHeaders(HttpResponse response,
Resource resource,
long count)
|
Methods inherited from class org.mortbay.http.handler.AbstractHttpHandler |
getHttpContext, getName, handleTrace, initialize, isStarted, setName, toString |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ResourceHandler()
Method Detail |
public void start() throws java.lang.Exception
LifeCycle
start
in interface LifeCycle
start
in class AbstractHttpHandler
java.lang.Exception
- An arbitrary exception may be thrown.public void stop() throws java.lang.InterruptedException
LifeCycle
stop
in interface LifeCycle
stop
in class AbstractHttpHandler
java.lang.InterruptedException
- Stopping a lifecycle is rarely atomic
and may be interrupted by another thread. If this happens
InterruptedException is throw and the component will be in an
indeterminant state and should probably be discarded.public java.lang.String[] getAllowedMethods()
public void setAllowedMethods(java.lang.String[] methods)
public boolean isMethodAllowed(java.lang.String method)
public java.lang.String getAllowedString()
public boolean isDirAllowed()
public void setDirAllowed(boolean dirAllowed)
public boolean isAcceptRanges()
public boolean getRedirectWelcome()
public void setRedirectWelcome(boolean redirectWelcome)
redirectWelcome
- True if welcome files are redirected to. False
if forward is used.public void setAcceptRanges(boolean ar)
ar
- True if the handler should accept rangespublic int getMinGzipLength()
public void setMinGzipLength(int minGzipLength)
minGzipLength
- If set to a positive integer, then static content
larger than this will be served as gzip content encoded
if a matching resource is found ending with ".gz"public void handle(java.lang.String pathInContext, java.lang.String pathParams, HttpRequest request, HttpResponse response) throws HttpException, java.io.IOException
HttpHandler
pathInContext
- The context pathpathParams
- Path parameters such as encoded Session IDrequest
- The HttpRequest requestresponse
- The HttpResponse response
HttpException
java.io.IOException
public void handleGet(HttpRequest request, HttpResponse response, java.lang.String pathInContext, java.lang.String pathParams, Resource resource) throws java.io.IOException
java.io.IOException
public void writeHeaders(HttpResponse response, Resource resource, long count) throws java.io.IOException
java.io.IOException
public void sendData(HttpRequest request, HttpResponse response, java.lang.String pathInContext, Resource resource, boolean writeHeaders) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |