public class StaticHttpHandler extends StaticHttpHandlerBase
HttpHandler, which processes requests to a static resources.| Modifier and Type | Field and Description |
|---|---|
protected ArraySet<java.io.File> |
docRoots |
| Constructor and Description |
|---|
StaticHttpHandler()
Create HttpHandler, which, by default, will handle requests
to the static resources located in the current directory.
|
StaticHttpHandler(java.util.Set<java.lang.String> docRoots)
Create a new instance which will look for static pages located
under the docRoot.
|
StaticHttpHandler(java.lang.String... docRoots)
Create a new instance which will look for static pages located
under the docRoot.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDocRoot(java.io.File docRoot)
Add the directory to the list of directories where files will be serviced from.
|
java.io.File |
addDocRoot(java.lang.String docRoot)
Add the directory to the list of directories where files will be serviced from.
|
java.io.File |
getDefaultDocRoot()
Return the default directory from where files will be serviced.
|
ArraySet<java.io.File> |
getDocRoots()
Return the list of directories where files will be serviced from.
|
protected boolean |
handle(java.lang.String uri,
Request request,
Response response)
Lookup a resource based on the request URI, and send it using send file.
|
void |
removeDocRoot(java.io.File docRoot)
Removes the directory from the list of directories where static files will be serviced from.
|
addCachingHeaders, addToFileCache, getRelativeURI, isFileCacheEnabled, lookupFileCache, onMissingResource, pickupContentType, sendFile, service, setFileCacheEnableddestroy, getErrorPageGenerator, getName, getRequestExecutorProvider, getRequestURIEncoding, isAllowCustomStatusMessage, isAllowEncodedSlash, sendAcknowledgment, setAllowCustomStatusMessage, setAllowEncodedSlash, setDecodeUrl, setDispatcherHelper, setRequestURIEncoding, setRequestURIEncoding, start, updatePathsprotected final ArraySet<java.io.File> docRoots
public StaticHttpHandler()
public StaticHttpHandler(java.lang.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(java.util.Set<java.lang.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 java.io.File getDefaultDocRoot()
public ArraySet<java.io.File> getDocRoots()
public final java.io.File addDocRoot(java.lang.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(java.io.File docRoot)
docRoot - the directory to be added to the list of directories
where files will be serviced from.public void removeDocRoot(java.io.File docRoot)
docRoot - the directory to remove.protected boolean handle(java.lang.String uri,
Request request,
Response response)
throws java.lang.Exception
handle in class StaticHttpHandlerBaseuri - The request URIrequest - the Requestresponse - the Responsejava.lang.ExceptionCopyright © 2013 Oracle Corporation. All Rights Reserved.