Class CLStaticHttpHandler
java.lang.Object
org.glassfish.grizzly.http.server.HttpHandler
org.glassfish.grizzly.http.server.StaticHttpHandlerBase
org.glassfish.grizzly.http.server.CLStaticHttpHandler
HttpHandler, which processes requests to a static resources resolved by a given ClassLoader.- Author:
- Grizzly Team
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCLStaticHttpHandler(ClassLoader classLoader, String... docRoots) Create HttpHandler, which will handle requests to the static resources resolved by the given class loader. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddDocRoot(String docRoot) Adds doc root (path prefix), which will be used to look up resources.Returns theClassLoaderused to resolve the requested HTTP resources.protected booleanLookup a resource based on the request URI, and process it.booleanremoveDocRoot(String docRoot) Removes docRoot from the doc root list.Methods inherited from class org.glassfish.grizzly.http.server.StaticHttpHandlerBase
addCachingHeaders, addToFileCache, getRelativeURI, isFileCacheEnabled, lookupFileCache, onMissingResource, pickupContentType, sendFile, service, setFileCacheEnabledMethods inherited from class org.glassfish.grizzly.http.server.HttpHandler
destroy, getErrorPageGenerator, getName, getRequestExecutorProvider, getRequestURIEncoding, getSessionCookieName, getSessionManager, isAllowCustomStatusMessage, isAllowEncodedSlash, sendAcknowledgment, setAllowCustomStatusMessage, setAllowEncodedSlash, setDecodeUrl, setDispatcherHelper, setRequestURIEncoding, setRequestURIEncoding, start, updatePaths
-
Field Details
-
CHECK_NON_SLASH_TERMINATED_FOLDERS_PROP
-
-
Constructor Details
-
CLStaticHttpHandler
Create HttpHandler, which will handle requests to the static resources resolved by the given class loader.- Parameters:
classLoader-ClassLoaderto 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 toClassLoader.getResource(java.lang.String). If no docRoots are set - the resources will be searched starting fromClassLoader's root.- Throws:
IllegalArgumentException- if one of the docRoots doesn't end with slash ('/')
-
-
Method Details
-
addDocRoot
Adds doc root (path prefix), which will be used to look up resources. Effectively each registered docRoot will be prepended to a resource path before passing it toClassLoader.getResource(java.lang.String).- Parameters:
docRoot-- Returns:
- true if this docroot hasn't been registered before, or false otherwise.
- Throws:
IllegalArgumentException- if one of the docRoots doesn't end with slash ('/')
-
removeDocRoot
Removes docRoot from the doc root list.- Parameters:
docRoot-- Returns:
- true if this docroot was found and removed from the list, or or false if this docroot was not found in the list.
-
getClassLoader
Returns theClassLoaderused to resolve the requested HTTP resources. -
handle
Lookup a resource based on the request URI, and process it.- Specified by:
handlein classStaticHttpHandlerBase- Parameters:
resourcePath- The request URIrequest- theRequestresponse- theResponse- Returns:
- true, if the static resource has been found and processed, or false, if the static resource hasn't been found
- Throws:
Exception
-