public abstract class StaticHttpHandlerBase extends HttpHandler
HttpHandler
implementations,
which processes requests to a static resources.Constructor and Description |
---|
StaticHttpHandlerBase() |
Modifier and Type | Method and Description |
---|---|
protected static void |
addCachingHeaders(Response response,
File file) |
boolean |
addToFileCache(Request req,
Response res,
File resource) |
protected String |
getRelativeURI(Request request) |
protected abstract boolean |
handle(String uri,
Request request,
Response response)
Lookup a resource based on the request URI, and send it using send file.
|
boolean |
isFileCacheEnabled()
Returns true if this StaticHttpHandler has been
configured to use file cache to serve static resources,
or false otherwise.
|
protected FileCacheFilter |
lookupFileCache(FilterChainContext fcContext) |
protected void |
onMissingResource(Request request,
Response response)
The method will be called, if the static resource requested by the
Request
wasn't found, so StaticHttpHandler implementation may try to
workaround this situation. |
protected static void |
pickupContentType(Response response,
String path) |
static void |
sendFile(Response response,
File file) |
void |
service(Request request,
Response response)
Based on the
Request URI, try to map the file from the
#getDocRoots() , and send it back to a client. |
void |
setFileCacheEnabled(boolean isFileCacheEnabled)
Set true to configure this StaticHttpHandler
to use file cache to serve static resources, or false otherwise.
|
destroy, getErrorPageGenerator, getName, getRequestExecutorProvider, getRequestURIEncoding, getSessionCookieName, getSessionManager, isAllowCustomStatusMessage, isAllowEncodedSlash, sendAcknowledgment, setAllowCustomStatusMessage, setAllowEncodedSlash, setDecodeUrl, setDispatcherHelper, setRequestURIEncoding, setRequestURIEncoding, start, updatePaths
public boolean isFileCacheEnabled()
FileCache.isEnabled()
. In this case StaticHttpHandler will operate
as if file cache was disabled.public void setFileCacheEnabled(boolean isFileCacheEnabled)
FileCache.isEnabled()
. In this case StaticHttpHandler will operate
as if file cache was disabled.isFileCacheEnabled
- true to configure this
StaticHttpHandler to use file cache to serve static resources,
or false otherwise.public static void sendFile(Response response, File file) throws IOException
IOException
public void service(Request request, Response response) throws Exception
Request
URI, try to map the file from the
#getDocRoots()
, and send it back to a client.service
in class HttpHandler
request
- the Request
response
- the Response
Exception
protected void onMissingResource(Request request, Response response) throws Exception
Request
wasn't found, so StaticHttpHandler
implementation may try to
workaround this situation.
The default implementation - sends a 404 response page by calling #customizedErrorPage(Request, Response)
.protected abstract boolean handle(String uri, Request request, Response response) throws Exception
protected FileCacheFilter lookupFileCache(FilterChainContext fcContext)
Copyright © 2015 Oracle Corporation. All rights reserved.