|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.http.server.StaticResourcesHandler
public class StaticResourcesHandler
Static resources handler, which handles static resources requests made to a
HttpService.
This class doesn't not decode the Request uri and just do
basic security check. If you need more protection, use the HttpService.
| Field Summary | |
|---|---|
protected File |
docRoot
|
protected String |
resourcesContextPath
|
| Constructor Summary | |
|---|---|
StaticResourcesHandler()
|
|
StaticResourcesHandler(File rootFolder)
|
|
StaticResourcesHandler(String rootFolder)
|
|
| Method Summary | |
|---|---|
boolean |
addToFileCache(Request req,
File resource)
|
File |
getDocRoot()
Return the directory from where files will be serviced. |
String |
getResourcesContextPath()
Return the context path used for servicing resources. |
boolean |
handle(Request req,
Response res)
Based on the Request URI, try to map the file from the
getDocRoot(), and send it synchronously
using send file. |
protected boolean |
handle(String uri,
Request req,
Response res)
Lookup a resource based on the request URI, and send it using send file. |
void |
setDocRoot(File docRoot)
Set the directory from where files will be serviced. |
void |
setDocRoot(String docRoot)
Set the directory from where files will be serviced. |
void |
setResourcesContextPath(String resourcesContextPath)
Set the context path used for servicing resource. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected volatile File docRoot
protected String resourcesContextPath
| Constructor Detail |
|---|
public StaticResourcesHandler()
public StaticResourcesHandler(String rootFolder)
public StaticResourcesHandler(File rootFolder)
| Method Detail |
|---|
public boolean handle(Request req,
Response res)
throws Exception
Request URI, try to map the file from the
getDocRoot(), and send it synchronously
using send file.
req - the Requestres - the Response
Exception
protected boolean handle(String uri,
Request req,
Response res)
throws Exception
uri - The request URIreq - the Requestres - the Response
Exceptionpublic File getDocRoot()
public void setDocRoot(String docRoot)
docRoot - the directory from where files will be serviced.public void setDocRoot(File docRoot)
docRoot - the directory from where files will be serviced.public String getResourcesContextPath()
public void setResourcesContextPath(String resourcesContextPath)
resourcesContextPath - the context path
public final boolean addToFileCache(Request req,
File resource)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||