Class StaticHandler
java.lang.Object
io.vertx.rxjava3.ext.web.handler.StaticHandler
- All Implemented Interfaces:
Handler<RoutingContext>, io.vertx.lang.rx.RxDelegate
public class StaticHandler
extends Object
implements io.vertx.lang.rx.RxDelegate, Handler<RoutingContext>
A handler for serving static resources from the file system or classpath.
NOTE: This class has been automatically generated from the original non RX-ified interface using Vert.x codegen.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final io.vertx.lang.rx.TypeArg<StaticHandler> static final booleanDefault of whether async filesystem access should always be usedstatic final longDefault cache entry timeout, when cachingstatic final booleanDefault of whether cache header handling is enabledstatic final booleanDefault of whether directory listing is enabledstatic final StringDefault template file to use for directory listingstatic final booleanDefault of whether fs async/sync tuning should be usedstatic final booleanDefault value of whether files are read -only and never will be updatedstatic final booleanDefault of whether hidden files can be servedstatic final StringThe default index pagestatic final longDefault max age for cache headersstatic final longDefault max avg serve time, in ns, over which serving will be considered slowstatic final intThe default max cache sizestatic final booleanDefault of whether Range request handling support should be usedstatic final booleanDefault of whether access to the root of the file system should be allowed or just allow from the current working directory.static final booleanDefault of whether vary header should be sent.static final StringDefault value of the web-root, where files are served from -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StaticHandlercreate()Create a handler using defaultsstatic StaticHandlercreate(FileSystemAccess handlerVisibility, String root) Create a handler, specifying web-root and access option: absolute path or relativestatic StaticHandlerCreate a handler, specifying web-rootbooleanvoidhandle(RoutingContext event) Something has happened, so handle it.inthashCode()static StaticHandlernewInstance(StaticHandler arg) setAlwaysAsyncFS(boolean alwaysAsyncFS) Set whether async filesystem access should always be usedsetCacheEntryTimeout(long timeout) Set the server cache entry timeout when caching is enabledsetCachingEnabled(boolean enabled) Set whether cache header handling is enabledsetDefaultContentEncoding(String contentEncoding) Set the default content encoding for text related files.setDirectoryListing(boolean directoryListing) Set whether directory listing is enabledsetDirectoryTemplate(String directoryTemplate) Set the directory template to be used when directory listingsetEnableFSTuning(boolean enableFSTuning) Set whether async/sync filesystem tuning should enabledsetEnableRangeSupport(boolean enableRangeSupport) Set whether range requests (resumable downloads; media streaming) should be enabled.setFilesReadOnly(boolean readOnly) Set whether files are read-only and will never changesetHttp2PushMapping(List<Http2PushMapping> http2PushMappings) Set the file mapping for http2push and link preloadsetIncludeHidden(boolean includeHidden) Set whether hidden files should be servedsetIndexPage(String indexPage) Set the index pagesetMaxAgeSeconds(long maxAgeSeconds) Set value for max age in caching headerssetMaxAvgServeTimeNs(long maxAvgServeTimeNanoSeconds) Set the max serve time in ns, above which serves are considered slowsetMaxCacheSize(int maxCacheSize) Set the max cache size, when caching is enabledsetSendVaryHeader(boolean varyHeader) Set whether vary header should be sent with response.skipCompressionForMediaTypes(Set<String> mediaTypes) Skip compression if the media type of the file to send is in the providedmediaTypesset.skipCompressionForSuffixes(Set<String> fileSuffixes) Skip compression if the suffix of the file to send is in the providedfileSuffixesset.toString()
-
Field Details
-
__TYPE_ARG
-
DEFAULT_WEB_ROOT
Default value of the web-root, where files are served from- See Also:
-
DEFAULT_FILES_READ_ONLY
public static final boolean DEFAULT_FILES_READ_ONLYDefault value of whether files are read -only and never will be updated- See Also:
-
DEFAULT_MAX_AGE_SECONDS
public static final long DEFAULT_MAX_AGE_SECONDSDefault max age for cache headers- See Also:
-
DEFAULT_CACHING_ENABLED
public static final boolean DEFAULT_CACHING_ENABLEDDefault of whether cache header handling is enabled -
DEFAULT_DIRECTORY_LISTING
public static final boolean DEFAULT_DIRECTORY_LISTINGDefault of whether directory listing is enabled- See Also:
-
DEFAULT_DIRECTORY_TEMPLATE
Default template file to use for directory listing- See Also:
-
DEFAULT_INCLUDE_HIDDEN
public static final boolean DEFAULT_INCLUDE_HIDDENDefault of whether hidden files can be served- See Also:
-
DEFAULT_CACHE_ENTRY_TIMEOUT
public static final long DEFAULT_CACHE_ENTRY_TIMEOUTDefault cache entry timeout, when caching- See Also:
-
DEFAULT_INDEX_PAGE
-
DEFAULT_MAX_CACHE_SIZE
public static final int DEFAULT_MAX_CACHE_SIZEThe default max cache size- See Also:
-
DEFAULT_ALWAYS_ASYNC_FS
public static final boolean DEFAULT_ALWAYS_ASYNC_FSDefault of whether async filesystem access should always be used- See Also:
-
DEFAULT_ENABLE_FS_TUNING
public static final boolean DEFAULT_ENABLE_FS_TUNINGDefault of whether fs async/sync tuning should be used- See Also:
-
DEFAULT_MAX_AVG_SERVE_TIME_NS
public static final long DEFAULT_MAX_AVG_SERVE_TIME_NSDefault max avg serve time, in ns, over which serving will be considered slow- See Also:
-
DEFAULT_RANGE_SUPPORT
public static final boolean DEFAULT_RANGE_SUPPORTDefault of whether Range request handling support should be used- See Also:
-
DEFAULT_ROOT_FILESYSTEM_ACCESS
public static final boolean DEFAULT_ROOT_FILESYSTEM_ACCESSDefault of whether access to the root of the file system should be allowed or just allow from the current working directory.- See Also:
-
DEFAULT_SEND_VARY_HEADER
public static final boolean DEFAULT_SEND_VARY_HEADERDefault of whether vary header should be sent.- See Also:
-
-
Constructor Details
-
StaticHandler
-
StaticHandler
-
-
Method Details
-
toString
-
equals
-
hashCode
-
getDelegate
- Specified by:
getDelegatein interfaceio.vertx.lang.rx.RxDelegate
-
handle
Something has happened, so handle it.- Specified by:
handlein interfaceHandler<RoutingContext>- Parameters:
event- the event to handle
-
create
-
create
Create a handler, specifying web-root- Parameters:
root- the web-root- Returns:
- the handler
-
create
Create a handler, specifying web-root and access option: absolute path or relative- Parameters:
handlerVisibility- CWD or file system rootroot- the web-root- Returns:
- the handler
-
setFilesReadOnly
Set whether files are read-only and will never change- Parameters:
readOnly- whether files are read-only- Returns:
- a reference to this, so the API can be used fluently
-
setMaxAgeSeconds
Set value for max age in caching headers- Parameters:
maxAgeSeconds- maximum time for browser to cache, in seconds- Returns:
- a reference to this, so the API can be used fluently
-
setCachingEnabled
Set whether cache header handling is enabled- Parameters:
enabled- true if enabled- Returns:
- a reference to this, so the API can be used fluently
-
setDirectoryListing
Set whether directory listing is enabled- Parameters:
directoryListing- true if enabled- Returns:
- a reference to this, so the API can be used fluently
-
setIncludeHidden
Set whether hidden files should be served- Parameters:
includeHidden- true if hidden files should be served- Returns:
- a reference to this, so the API can be used fluently
-
setCacheEntryTimeout
Set the server cache entry timeout when caching is enabled- Parameters:
timeout- the timeout, in ms- Returns:
- a reference to this, so the API can be used fluently
-
setIndexPage
Set the index page- Parameters:
indexPage- the index page- Returns:
- a reference to this, so the API can be used fluently
-
setMaxCacheSize
Set the max cache size, when caching is enabled- Parameters:
maxCacheSize- the max cache size- Returns:
- a reference to this, so the API can be used fluently
-
setHttp2PushMapping
Set the file mapping for http2push and link preload- Parameters:
http2PushMappings- the mapping for http2 push- Returns:
- a reference to this, so the API can be used fluently
-
skipCompressionForMediaTypes
Skip compression if the media type of the file to send is in the providedmediaTypesset.Content-Encodingheader set toidentityfor the types present in themediaTypesset- Parameters:
mediaTypes- the set of mime types that are already compressed- Returns:
- a reference to this, so the API can be used fluently
-
skipCompressionForSuffixes
Skip compression if the suffix of the file to send is in the providedfileSuffixesset.Content-Encodingheader set toidentityfor the suffixes present in thefileSuffixesset- Parameters:
fileSuffixes- the set of file suffixes that are already compressed- Returns:
- a reference to this, so the API can be used fluently
-
setAlwaysAsyncFS
Set whether async filesystem access should always be used- Parameters:
alwaysAsyncFS- true for always async FS access- Returns:
- a reference to this, so the API can be used fluently
-
setEnableFSTuning
Set whether async/sync filesystem tuning should enabled- Parameters:
enableFSTuning- true to enabled FS tuning- Returns:
- a reference to this, so the API can be used fluently
-
setMaxAvgServeTimeNs
Set the max serve time in ns, above which serves are considered slow- Parameters:
maxAvgServeTimeNanoSeconds- max serve time, in ns- Returns:
- a reference to this, so the API can be used fluently
-
setDirectoryTemplate
Set the directory template to be used when directory listing- Parameters:
directoryTemplate- the directory template- Returns:
- a reference to this, so the API can be used fluently
-
setEnableRangeSupport
Set whether range requests (resumable downloads; media streaming) should be enabled.- Parameters:
enableRangeSupport- true to enable range support- Returns:
- a reference to this, so the API can be used fluently
-
setSendVaryHeader
Set whether vary header should be sent with response.- Parameters:
varyHeader- true to sent vary header- Returns:
- a reference to this, so the API can be used fluently
-
setDefaultContentEncoding
Set the default content encoding for text related files. This allows overriding the system settings default value.- Parameters:
contentEncoding- the desired content encoding e.g.: "UTF-8"- Returns:
- a reference to this, so the API can be used fluently
-
newInstance
-