public class CLStaticHttpHandler extends StaticHttpHandlerBase
HttpHandler
, which processes requests to a static resources resolved
by a given ClassLoader
.Modifier and Type | Field and Description |
---|---|
protected static String |
CHECK_NON_SLASH_TERMINATED_FOLDERS_PROP |
Constructor and Description |
---|
CLStaticHttpHandler(ClassLoader classLoader,
String... docRoots)
Create HttpHandler, which will handle requests
to the static resources resolved by the given class loader.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addDocRoot(String docRoot)
Adds doc root (path prefix), which will be used to look up resources.
|
ClassLoader |
getClassLoader()
Returns the
ClassLoader used to resolve the requested HTTP resources. |
protected boolean |
handle(String resourcePath,
Request request,
Response response)
Lookup a resource based on the request URI, and send it using send file.
|
boolean |
removeDocRoot(String docRoot)
Removes docRoot from the doc root list.
|
addCachingHeaders, addToFileCache, getRelativeURI, isFileCacheEnabled, lookupFileCache, onMissingResource, pickupContentType, sendFile, service, setFileCacheEnabled
destroy, getErrorPageGenerator, getName, getRequestExecutorProvider, getRequestURIEncoding, getSessionCookieName, getSessionManager, isAllowCustomStatusMessage, isAllowEncodedSlash, sendAcknowledgment, setAllowCustomStatusMessage, setAllowEncodedSlash, setDecodeUrl, setDispatcherHelper, setRequestURIEncoding, setRequestURIEncoding, start, updatePaths
protected static final String CHECK_NON_SLASH_TERMINATED_FOLDERS_PROP
public CLStaticHttpHandler(ClassLoader classLoader, String... docRoots)
classLoader
- ClassLoader
to be used to resolve the resourcesdocRoots
- the doc roots (path prefixes), which will be used
to find resources. Effectively each docRoot will be prepended
to a resource path before passing it to ClassLoader.getResource(java.lang.String)
.
If no docRoots are set - the resources will be searched starting
from ClassLoader
's root.IllegalArgumentException
- if one of the docRoots doesn't end with slash ('/')public boolean addDocRoot(String docRoot)
ClassLoader.getResource(java.lang.String)
.docRoot
- IllegalArgumentException
- if one of the docRoots doesn't end with slash ('/')public boolean removeDocRoot(String docRoot)
docRoot
- public ClassLoader getClassLoader()
ClassLoader
used to resolve the requested HTTP resources.protected boolean handle(String resourcePath, Request request, Response response) throws Exception
handle
in class StaticHttpHandlerBase
resourcePath
- The request URIrequest
- the Request
response
- the Response
Exception
Copyright © 2015 Oracle Corporation. All rights reserved.