public class StaticHttpHandler extends StaticHttpHandlerBase
HttpHandler, which processes requests to a static resources.| Modifier and Type | Field and Description |
|---|---|
protected org.glassfish.grizzly.utils.ArraySet<File> |
docRoots |
| Constructor and Description |
|---|
StaticHttpHandler()
Create HttpHandler, which, by default, will handle requests
to the static resources located in the current directory.
|
StaticHttpHandler(Set<String> docRoots)
Create a new instance which will look for static pages located
under the docRoot.
|
StaticHttpHandler(String... docRoots)
Create a new instance which will look for static pages located
under the docRoot.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDocRoot(File docRoot)
Add the directory to the list of directories where files will be serviced from.
|
File |
addDocRoot(String docRoot)
Add the directory to the list of directories where files will be serviced from.
|
File |
getDefaultDocRoot()
Return the default directory from where files will be serviced.
|
org.glassfish.grizzly.utils.ArraySet<File> |
getDocRoots()
Return the list of directories where files will be serviced from.
|
protected boolean |
handle(String uri,
Request request,
Response response)
Lookup a resource based on the request URI, and process it.
|
boolean |
isDirectorySlashOff() |
void |
removeDocRoot(File docRoot)
Removes the directory from the list of directories where static files will be serviced from.
|
void |
setDirectorySlashOff(boolean directorySlashOff)
If the directorySlashOff is true HTTP 301 redirect will not be
sent when requested static resource is a directory.
|
addCachingHeaders, addToFileCache, getRelativeURI, isFileCacheEnabled, lookupFileCache, onMissingResource, pickupContentType, sendFile, service, setFileCacheEnableddestroy, getErrorPageGenerator, getName, getRequestExecutorProvider, getRequestURIEncoding, getSessionCookieName, getSessionManager, isAllowCustomStatusMessage, isAllowEncodedSlash, sendAcknowledgment, setAllowCustomStatusMessage, setAllowEncodedSlash, setDecodeUrl, setDispatcherHelper, setRequestURIEncoding, setRequestURIEncoding, start, updatePathsprotected final org.glassfish.grizzly.utils.ArraySet<File> docRoots
public StaticHttpHandler()
public StaticHttpHandler(String... docRoots)
docRoots - the folder(s) where the static resource are located.
If the docRoot is null - static pages won't be served
by this HttpHandlerpublic StaticHttpHandler(Set<String> docRoots)
docRoots - the folders where the static resource are located.
If the docRoot is empty - static pages won't be served
by this HttpHandlerpublic File getDefaultDocRoot()
public org.glassfish.grizzly.utils.ArraySet<File> getDocRoots()
public final File addDocRoot(String docRoot)
docRoot - the directory to be added to the list of directories
where files will be serviced from.File representation of the passed docRoot.public final void addDocRoot(File docRoot)
docRoot - the directory to be added to the list of directories
where files will be serviced from.public void removeDocRoot(File docRoot)
docRoot - the directory to remove.public boolean isDirectorySlashOff()
public void setDirectorySlashOff(boolean directorySlashOff)
directorySlashOff - protected boolean handle(String uri, Request request, Response response) throws Exception
handle in class StaticHttpHandlerBaseuri - The request URIrequest - the Requestresponse - the ResponseExceptionCopyright © 2017–2019 Oracle Corporation. All rights reserved.