public class StaticHandlerImpl extends Object implements StaticHandler
DEFAULT_ALWAYS_ASYNC_FS, DEFAULT_CACHE_ENTRY_TIMEOUT, DEFAULT_CACHING_ENABLED, DEFAULT_DIRECTORY_LISTING, DEFAULT_DIRECTORY_TEMPLATE, DEFAULT_ENABLE_FS_TUNING, DEFAULT_FILES_READ_ONLY, DEFAULT_INCLUDE_HIDDEN, DEFAULT_INDEX_PAGE, DEFAULT_MAX_AGE_SECONDS, DEFAULT_MAX_AVG_SERVE_TIME_NS, DEFAULT_MAX_CACHE_SIZE, DEFAULT_RANGE_SUPPORT, DEFAULT_ROOT_FILESYSTEM_ACCESS, DEFAULT_SEND_VARY_HEADER, DEFAULT_WEB_ROOT| Constructor and Description |
|---|
StaticHandlerImpl(String root) |
StaticHandlerImpl(String root,
ClassLoader classLoader)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
handle(RoutingContext context)
Something has happened, so handle it.
|
StaticHandler |
setAllowRootFileSystemAccess(boolean allowRootFileSystemAccess)
Enable/Disable access to the root of the filesystem
|
StaticHandler |
setAlwaysAsyncFS(boolean alwaysAsyncFS)
Set whether async filesystem access should always be used
|
StaticHandler |
setCacheEntryTimeout(long timeout)
Set the server cache entry timeout when caching is enabled
|
StaticHandler |
setCachingEnabled(boolean enabled)
Set whether cache header handling is enabled
|
StaticHandler |
setDefaultContentEncoding(String contentEncoding)
Set the default content encoding for text related files.
|
StaticHandler |
setDirectoryListing(boolean directoryListing)
Set whether directory listing is enabled
|
StaticHandler |
setDirectoryTemplate(String directoryTemplate)
Set the directory template to be used when directory listing
|
StaticHandler |
setEnableFSTuning(boolean enableFSTuning)
Set whether async/sync filesystem tuning should enabled
|
StaticHandler |
setEnableRangeSupport(boolean enableRangeSupport)
Set whether range requests (resumable downloads; media streaming) should be enabled.
|
StaticHandler |
setFilesReadOnly(boolean readOnly)
Set whether files are read-only and will never change
|
StaticHandler |
setHttp2PushMapping(List<Http2PushMapping> http2PushMap)
Set the file mapping for http2push and link preload
|
StaticHandler |
setIncludeHidden(boolean includeHidden)
Set whether hidden files should be served
|
StaticHandler |
setIndexPage(String indexPage)
Set the index page
|
StaticHandler |
setMaxAgeSeconds(long maxAgeSeconds)
Set value for max age in caching headers
|
StaticHandler |
setMaxAvgServeTimeNs(long maxAvgServeTimeNanoSeconds)
Set the max serve time in ns, above which serves are considered slow
|
StaticHandler |
setMaxCacheSize(int maxCacheSize)
Set the max cache size, when caching is enabled
|
StaticHandler |
setSendVaryHeader(boolean sendVaryHeader)
Set whether vary header should be sent with response.
|
StaticHandler |
setWebRoot(String webRoot)
Set the web root
|
StaticHandler |
skipCompressionForMediaTypes(Set<String> mediaTypes)
Skip compression if the media type of the file to send is in the provided
mediaTypes set. |
StaticHandler |
skipCompressionForSuffixes(Set<String> fileSuffixes)
Skip compression if the suffix of the file to send is in the provided
fileSuffixes set. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreate, create, create@Deprecated public StaticHandlerImpl(String root, ClassLoader classLoader)
public StaticHandlerImpl(String root)
public void handle(RoutingContext context)
Handlerhandle in interface Handler<RoutingContext>context - the event to handlepublic StaticHandler setAllowRootFileSystemAccess(boolean allowRootFileSystemAccess)
StaticHandlersetAllowRootFileSystemAccess in interface StaticHandlerallowRootFileSystemAccess - whether root access is allowedpublic StaticHandler setWebRoot(String webRoot)
StaticHandlersetWebRoot in interface StaticHandlerwebRoot - the web rootpublic StaticHandler setFilesReadOnly(boolean readOnly)
StaticHandlersetFilesReadOnly in interface StaticHandlerreadOnly - whether files are read-onlypublic StaticHandler setMaxAgeSeconds(long maxAgeSeconds)
StaticHandlersetMaxAgeSeconds in interface StaticHandlermaxAgeSeconds - maximum time for browser to cache, in secondspublic StaticHandler setMaxCacheSize(int maxCacheSize)
StaticHandlersetMaxCacheSize in interface StaticHandlermaxCacheSize - the max cache sizepublic StaticHandler setCachingEnabled(boolean enabled)
StaticHandlersetCachingEnabled in interface StaticHandlerenabled - true if enabledpublic StaticHandler setDirectoryListing(boolean directoryListing)
StaticHandlersetDirectoryListing in interface StaticHandlerdirectoryListing - true if enabledpublic StaticHandler setDirectoryTemplate(String directoryTemplate)
StaticHandlersetDirectoryTemplate in interface StaticHandlerdirectoryTemplate - the directory templatepublic StaticHandler setEnableRangeSupport(boolean enableRangeSupport)
StaticHandlersetEnableRangeSupport in interface StaticHandlerenableRangeSupport - true to enable range supportpublic StaticHandler setIncludeHidden(boolean includeHidden)
StaticHandlersetIncludeHidden in interface StaticHandlerincludeHidden - true if hidden files should be servedpublic StaticHandler setCacheEntryTimeout(long timeout)
StaticHandlersetCacheEntryTimeout in interface StaticHandlertimeout - the timeout, in mspublic StaticHandler setIndexPage(String indexPage)
StaticHandlersetIndexPage in interface StaticHandlerindexPage - the index pagepublic StaticHandler setAlwaysAsyncFS(boolean alwaysAsyncFS)
StaticHandlersetAlwaysAsyncFS in interface StaticHandleralwaysAsyncFS - true for always async FS accesspublic StaticHandler setHttp2PushMapping(List<Http2PushMapping> http2PushMap)
StaticHandlersetHttp2PushMapping in interface StaticHandlerhttp2PushMap - the mapping for http2 pushpublic StaticHandler skipCompressionForMediaTypes(Set<String> mediaTypes)
StaticHandlermediaTypes set.
Content-Encoding header set to identity for the types present in the mediaTypes setskipCompressionForMediaTypes in interface StaticHandlermediaTypes - the set of mime types that are already compressedpublic StaticHandler skipCompressionForSuffixes(Set<String> fileSuffixes)
StaticHandlerfileSuffixes set.
Content-Encoding header set to identity for the suffixes present in the fileSuffixes setskipCompressionForSuffixes in interface StaticHandlerfileSuffixes - the set of file suffixes that are already compressedpublic StaticHandler setEnableFSTuning(boolean enableFSTuning)
StaticHandlersetEnableFSTuning in interface StaticHandlerenableFSTuning - true to enabled FS tuningpublic StaticHandler setMaxAvgServeTimeNs(long maxAvgServeTimeNanoSeconds)
StaticHandlersetMaxAvgServeTimeNs in interface StaticHandlermaxAvgServeTimeNanoSeconds - max serve time, in nspublic StaticHandler setSendVaryHeader(boolean sendVaryHeader)
StaticHandlersetSendVaryHeader in interface StaticHandlersendVaryHeader - true to sent vary headerpublic StaticHandler setDefaultContentEncoding(String contentEncoding)
StaticHandlersetDefaultContentEncoding in interface StaticHandlercontentEncoding - the desired content encoding e.g.: "UTF-8"Copyright © 2020. All rights reserved.