Package io.vertx.mutiny.ext.web.handler
Class StaticHandler
- java.lang.Object
-
- io.vertx.mutiny.ext.web.handler.StaticHandler
-
- All Implemented Interfaces:
io.vertx.core.Handler<RoutingContext>,Consumer<RoutingContext>
public class StaticHandler extends Object implements io.vertx.core.Handler<RoutingContext>, Consumer<RoutingContext>
A handler for serving static resources from the file system or classpath. NOTE: This class has been automatically generated from theoriginalnon Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<StaticHandler>__TYPE_ARGstatic booleanDEFAULT_ALWAYS_ASYNC_FSDefault of whether async filesystem access should always be usedstatic longDEFAULT_CACHE_ENTRY_TIMEOUTDefault cache entry timeout, when cachingstatic booleanDEFAULT_CACHING_ENABLEDDefault of whether cache header handling is enabledstatic booleanDEFAULT_DIRECTORY_LISTINGDefault of whether directory listing is enabledstatic StringDEFAULT_DIRECTORY_TEMPLATEDefault template file to use for directory listingstatic booleanDEFAULT_ENABLE_FS_TUNINGDefault of whether fs async/sync tuning should be usedstatic booleanDEFAULT_FILES_READ_ONLYDefault value of whether files are read -only and never will be updatedstatic booleanDEFAULT_INCLUDE_HIDDENDefault of whether hidden files can be servedstatic StringDEFAULT_INDEX_PAGEThe default index pagestatic longDEFAULT_MAX_AGE_SECONDSDefault max age for cache headersstatic longDEFAULT_MAX_AVG_SERVE_TIME_NSDefault max avg serve time, in ns, over which serving will be considered slowstatic intDEFAULT_MAX_CACHE_SIZEThe default max cache sizestatic booleanDEFAULT_RANGE_SUPPORTDefault of whether Range request handling support should be usedstatic booleanDEFAULT_ROOT_FILESYSTEM_ACCESSDefault of whether access to the root of the file system should be allowed or just allow from the current working directory.static booleanDEFAULT_SEND_VARY_HEADERDefault of whether vary header should be sent.static StringDEFAULT_WEB_ROOTDefault value of the web-root, where files are served from
-
Constructor Summary
Constructors Constructor Description StaticHandler(io.vertx.ext.web.handler.StaticHandler delegate)StaticHandler(Object delegate)
-
Method Summary
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<StaticHandler> __TYPE_ARG
-
DEFAULT_WEB_ROOT
public static final String DEFAULT_WEB_ROOT
Default value of the web-root, where files are served from- See Also:
- Constant Field Values
-
DEFAULT_FILES_READ_ONLY
public static final boolean DEFAULT_FILES_READ_ONLY
Default value of whether files are read -only and never will be updated- See Also:
- Constant Field Values
-
DEFAULT_MAX_AGE_SECONDS
public static final long DEFAULT_MAX_AGE_SECONDS
Default max age for cache headers- See Also:
- Constant Field Values
-
DEFAULT_CACHING_ENABLED
public static final boolean DEFAULT_CACHING_ENABLED
Default of whether cache header handling is enabled
-
DEFAULT_DIRECTORY_LISTING
public static final boolean DEFAULT_DIRECTORY_LISTING
Default of whether directory listing is enabled- See Also:
- Constant Field Values
-
DEFAULT_DIRECTORY_TEMPLATE
public static final String DEFAULT_DIRECTORY_TEMPLATE
Default template file to use for directory listing- See Also:
- Constant Field Values
-
DEFAULT_INCLUDE_HIDDEN
public static final boolean DEFAULT_INCLUDE_HIDDEN
Default of whether hidden files can be served- See Also:
- Constant Field Values
-
DEFAULT_CACHE_ENTRY_TIMEOUT
public static final long DEFAULT_CACHE_ENTRY_TIMEOUT
Default cache entry timeout, when caching- See Also:
- Constant Field Values
-
DEFAULT_INDEX_PAGE
public static final String DEFAULT_INDEX_PAGE
The default index page- See Also:
- Constant Field Values
-
DEFAULT_MAX_CACHE_SIZE
public static final int DEFAULT_MAX_CACHE_SIZE
The default max cache size- See Also:
- Constant Field Values
-
DEFAULT_ALWAYS_ASYNC_FS
public static final boolean DEFAULT_ALWAYS_ASYNC_FS
Default of whether async filesystem access should always be used- See Also:
- Constant Field Values
-
DEFAULT_ENABLE_FS_TUNING
public static final boolean DEFAULT_ENABLE_FS_TUNING
Default of whether fs async/sync tuning should be used- See Also:
- Constant Field Values
-
DEFAULT_MAX_AVG_SERVE_TIME_NS
public static final long DEFAULT_MAX_AVG_SERVE_TIME_NS
Default max avg serve time, in ns, over which serving will be considered slow- See Also:
- Constant Field Values
-
DEFAULT_RANGE_SUPPORT
public static final boolean DEFAULT_RANGE_SUPPORT
Default of whether Range request handling support should be used- See Also:
- Constant Field Values
-
DEFAULT_ROOT_FILESYSTEM_ACCESS
public static final boolean DEFAULT_ROOT_FILESYSTEM_ACCESS
Default of whether access to the root of the file system should be allowed or just allow from the current working directory.- See Also:
- Constant Field Values
-
DEFAULT_SEND_VARY_HEADER
public static final boolean DEFAULT_SEND_VARY_HEADER
Default of whether vary header should be sent.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StaticHandler
public StaticHandler(io.vertx.ext.web.handler.StaticHandler delegate)
-
StaticHandler
public StaticHandler(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.ext.web.handler.StaticHandler getDelegate()
-
handle
public void handle(RoutingContext arg0)
- Specified by:
handlein interfaceio.vertx.core.Handler<RoutingContext>
-
create
public static StaticHandler create()
- Returns:
- the handler
-
create
public static StaticHandler create(String root)
- Parameters:
root- the web-root- Returns:
- the handler
-
setAllowRootFileSystemAccess
public StaticHandler setAllowRootFileSystemAccess(boolean allowRootFileSystemAccess)
- Parameters:
allowRootFileSystemAccess- whether root access is allowed- Returns:
- a reference to this, so the API can be used fluently
-
setWebRoot
public StaticHandler setWebRoot(String webRoot)
- Parameters:
webRoot- the web root- Returns:
- a reference to this, so the API can be used fluently
-
setFilesReadOnly
public StaticHandler setFilesReadOnly(boolean readOnly)
- Parameters:
readOnly- whether files are read-only- Returns:
- a reference to this, so the API can be used fluently
-
setMaxAgeSeconds
public StaticHandler setMaxAgeSeconds(long maxAgeSeconds)
- Parameters:
maxAgeSeconds- maximum time for browser to cache, in seconds- Returns:
- a reference to this, so the API can be used fluently
-
setCachingEnabled
public StaticHandler setCachingEnabled(boolean enabled)
- Parameters:
enabled- true if enabled- Returns:
- a reference to this, so the API can be used fluently
-
setDirectoryListing
public StaticHandler setDirectoryListing(boolean directoryListing)
- Parameters:
directoryListing- true if enabled- Returns:
- a reference to this, so the API can be used fluently
-
setIncludeHidden
public StaticHandler setIncludeHidden(boolean includeHidden)
- Parameters:
includeHidden- true if hidden files should be served- Returns:
- a reference to this, so the API can be used fluently
-
setCacheEntryTimeout
public StaticHandler setCacheEntryTimeout(long timeout)
- Parameters:
timeout- the timeout, in ms- Returns:
- a reference to this, so the API can be used fluently
-
setIndexPage
public StaticHandler setIndexPage(String indexPage)
- Parameters:
indexPage- the index page- Returns:
- a reference to this, so the API can be used fluently
-
setMaxCacheSize
public StaticHandler setMaxCacheSize(int maxCacheSize)
- Parameters:
maxCacheSize- the max cache size- Returns:
- a reference to this, so the API can be used fluently
-
setHttp2PushMapping
public StaticHandler setHttp2PushMapping(List<io.vertx.ext.web.Http2PushMapping> http2PushMappings)
- Parameters:
http2PushMappings- the mapping for http2 push- Returns:
- a reference to this, so the API can be used fluently
-
skipCompressionForMediaTypes
public StaticHandler skipCompressionForMediaTypes(Set<String> mediaTypes)
- Parameters:
mediaTypes- the set of mime types that are already compressed- Returns:
- a reference to this, so the API can be used fluently
-
skipCompressionForSuffixes
public StaticHandler skipCompressionForSuffixes(Set<String> fileSuffixes)
- Parameters:
fileSuffixes- the set of file suffixes that are already compressed- Returns:
- a reference to this, so the API can be used fluently
-
setAlwaysAsyncFS
public StaticHandler setAlwaysAsyncFS(boolean alwaysAsyncFS)
- Parameters:
alwaysAsyncFS- true for always async FS access- Returns:
- a reference to this, so the API can be used fluently
-
setEnableFSTuning
public StaticHandler setEnableFSTuning(boolean enableFSTuning)
- Parameters:
enableFSTuning- true to enabled FS tuning- Returns:
- a reference to this, so the API can be used fluently
-
setMaxAvgServeTimeNs
public StaticHandler setMaxAvgServeTimeNs(long maxAvgServeTimeNanoSeconds)
- Parameters:
maxAvgServeTimeNanoSeconds- max serve time, in ns- Returns:
- a reference to this, so the API can be used fluently
-
setDirectoryTemplate
public StaticHandler setDirectoryTemplate(String directoryTemplate)
- Parameters:
directoryTemplate- the directory template- Returns:
- a reference to this, so the API can be used fluently
-
setEnableRangeSupport
public StaticHandler setEnableRangeSupport(boolean enableRangeSupport)
- Parameters:
enableRangeSupport- true to enable range support- Returns:
- a reference to this, so the API can be used fluently
-
setSendVaryHeader
public StaticHandler setSendVaryHeader(boolean varyHeader)
- Parameters:
varyHeader- true to sent vary header- Returns:
- a reference to this, so the API can be used fluently
-
setDefaultContentEncoding
public StaticHandler setDefaultContentEncoding(String contentEncoding)
- Parameters:
contentEncoding- the desired content encoding e.g.: "UTF-8"- Returns:
- a reference to this, so the API can be used fluently
-
accept
public void accept(RoutingContext item)
- Specified by:
acceptin interfaceConsumer<RoutingContext>
-
newInstance
public static StaticHandler newInstance(io.vertx.ext.web.handler.StaticHandler arg)
-
-