Class StaticHttpHandlerBase
java.lang.Object
org.glassfish.grizzly.http.server.HttpHandler
org.glassfish.grizzly.http.server.StaticHttpHandlerBase
- Direct Known Subclasses:
CLStaticHttpHandler,StaticHttpHandler
The basic class for
HttpHandler implementations,
which processes requests to a static resources.- Author:
- Jeanfrancois Arcand, Alexey Stashok
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidaddCachingHeaders(Response response, File file) final booleanaddToFileCache(Request req, Response res, File resource) protected StringgetRelativeURI(Request request) protected abstract booleanLookup a resource based on the request URI, and process it.booleanReturns true if this StaticHttpHandler has been configured to use file cache to serve static resources, or false otherwise.protected FileCacheFilterlookupFileCache(org.glassfish.grizzly.filterchain.FilterChainContext fcContext) protected voidonMissingResource(Request request, Response response) The method will be called, if the static resource requested by theRequestwasn't found, soStaticHttpHandlerimplementation may try to workaround this situation.protected static voidpickupContentType(Response response, String path) static voidvoidBased on theRequestURI, try to map the file from the#getDocRoots(), and send it back to a client.voidsetFileCacheEnabled(boolean isFileCacheEnabled) Set true to configure this StaticHttpHandler to use file cache to serve static resources, or false otherwise.Methods 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
-
Constructor Details
-
StaticHttpHandlerBase
public StaticHttpHandlerBase()
-
-
Method Details
-
isFileCacheEnabled
public boolean isFileCacheEnabled()Returns true if this StaticHttpHandler has been configured to use file cache to serve static resources, or false otherwise. Please note, even though this StaticHttpHandler might be configured to use file cache, file cache itself might be disabledFileCache.isEnabled(). In this case StaticHttpHandler will operate as if file cache was disabled.- Returns:
- true if this StaticHttpHandler has been configured to use file cache to serve static resources, or false otherwise.
-
setFileCacheEnabled
public void setFileCacheEnabled(boolean isFileCacheEnabled) Set true to configure this StaticHttpHandler to use file cache to serve static resources, or false otherwise. Please note, even though this StaticHttpHandler might be configured to use file cache, file cache itself might be disabledFileCache.isEnabled(). In this case StaticHttpHandler will operate as if file cache was disabled.- Parameters:
isFileCacheEnabled- true to configure this StaticHttpHandler to use file cache to serve static resources, or false otherwise.
-
sendFile
- Throws:
IOException
-
addToFileCache
-
service
Based on theRequestURI, try to map the file from the#getDocRoots(), and send it back to a client.- Specified by:
servicein classHttpHandler- Parameters:
request- theRequestresponse- theResponse- Throws:
Exception
-
getRelativeURI
- Throws:
Exception
-
onMissingResource
The method will be called, if the static resource requested by theRequestwasn't found, soStaticHttpHandlerimplementation may try to workaround this situation. The default implementation - sends a 404 response page by calling#customizedErrorPage(Request, Response). -
handle
Lookup a resource based on the request URI, and process it. -
lookupFileCache
protected FileCacheFilter lookupFileCache(org.glassfish.grizzly.filterchain.FilterChainContext fcContext) -
pickupContentType
-
addCachingHeaders
-