Class StaticHandler
- java.lang.Object
- 
- io.vertx.reactivex.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 originalnon RX-ified interface using Vert.x codegen.
- 
- 
Field SummaryFields Modifier and Type Field Description static io.vertx.lang.rx.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 SummaryConstructors Constructor Description StaticHandler(StaticHandler delegate)StaticHandler(Object delegate)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static 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(String root)Create a handler, specifying web-rootbooleanequals(Object o)StaticHandlergetDelegate()voidhandle(RoutingContext event)Something has happened, so handle it.inthashCode()static StaticHandlernewInstance(StaticHandler arg)StaticHandlersetAlwaysAsyncFS(boolean alwaysAsyncFS)Set whether async filesystem access should always be usedStaticHandlersetCacheEntryTimeout(long timeout)Set the server cache entry timeout when caching is enabledStaticHandlersetCachingEnabled(boolean enabled)Set whether cache header handling is enabledStaticHandlersetDefaultContentEncoding(String contentEncoding)Set the default content encoding for text related files.StaticHandlersetDirectoryListing(boolean directoryListing)Set whether directory listing is enabledStaticHandlersetDirectoryTemplate(String directoryTemplate)Set the directory template to be used when directory listingStaticHandlersetEnableFSTuning(boolean enableFSTuning)Set whether async/sync filesystem tuning should enabledStaticHandlersetEnableRangeSupport(boolean enableRangeSupport)Set whether range requests (resumable downloads; media streaming) should be enabled.StaticHandlersetFilesReadOnly(boolean readOnly)Set whether files are read-only and will never changeStaticHandlersetHttp2PushMapping(List<Http2PushMapping> http2PushMappings)Set the file mapping for http2push and link preloadStaticHandlersetIncludeHidden(boolean includeHidden)Set whether hidden files should be servedStaticHandlersetIndexPage(String indexPage)Set the index pageStaticHandlersetMaxAgeSeconds(long maxAgeSeconds)Set value for max age in caching headersStaticHandlersetMaxAvgServeTimeNs(long maxAvgServeTimeNanoSeconds)Set the max serve time in ns, above which serves are considered slowStaticHandlersetMaxCacheSize(int maxCacheSize)Set the max cache size, when caching is enabledStaticHandlersetSendVaryHeader(boolean varyHeader)Set whether vary header should be sent with response.StaticHandlerskipCompressionForMediaTypes(Set<String> mediaTypes)Skip compression if the media type of the file to send is in the providedmediaTypesset.StaticHandlerskipCompressionForSuffixes(Set<String> fileSuffixes)Skip compression if the suffix of the file to send is in the providedfileSuffixesset.StringtoString()
 
- 
- 
- 
Field Detail- 
__TYPE_ARGpublic static final io.vertx.lang.rx.TypeArg<StaticHandler> __TYPE_ARG 
 - 
DEFAULT_WEB_ROOTpublic 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_ONLYpublic 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_SECONDSpublic static final long DEFAULT_MAX_AGE_SECONDS Default max age for cache headers- See Also:
- Constant Field Values
 
 - 
DEFAULT_CACHING_ENABLEDpublic static final boolean DEFAULT_CACHING_ENABLED Default of whether cache header handling is enabled
 - 
DEFAULT_DIRECTORY_LISTINGpublic static final boolean DEFAULT_DIRECTORY_LISTING Default of whether directory listing is enabled- See Also:
- Constant Field Values
 
 - 
DEFAULT_DIRECTORY_TEMPLATEpublic static final String DEFAULT_DIRECTORY_TEMPLATE Default template file to use for directory listing- See Also:
- Constant Field Values
 
 - 
DEFAULT_INCLUDE_HIDDENpublic static final boolean DEFAULT_INCLUDE_HIDDEN Default of whether hidden files can be served- See Also:
- Constant Field Values
 
 - 
DEFAULT_CACHE_ENTRY_TIMEOUTpublic static final long DEFAULT_CACHE_ENTRY_TIMEOUT Default cache entry timeout, when caching- See Also:
- Constant Field Values
 
 - 
DEFAULT_INDEX_PAGEpublic static final String DEFAULT_INDEX_PAGE The default index page- See Also:
- Constant Field Values
 
 - 
DEFAULT_MAX_CACHE_SIZEpublic static final int DEFAULT_MAX_CACHE_SIZE The default max cache size- See Also:
- Constant Field Values
 
 - 
DEFAULT_ALWAYS_ASYNC_FSpublic 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_TUNINGpublic 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_NSpublic 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_SUPPORTpublic static final boolean DEFAULT_RANGE_SUPPORT Default of whether Range request handling support should be used- See Also:
- Constant Field Values
 
 - 
DEFAULT_ROOT_FILESYSTEM_ACCESSpublic 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_HEADERpublic static final boolean DEFAULT_SEND_VARY_HEADER Default of whether vary header should be sent.- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
StaticHandlerpublic StaticHandler(StaticHandler delegate) 
 - 
StaticHandlerpublic StaticHandler(Object delegate) 
 
- 
 - 
Method Detail- 
getDelegatepublic StaticHandler getDelegate() - Specified by:
- getDelegatein interface- io.vertx.lang.rx.RxDelegate
 
 - 
handlepublic void handle(RoutingContext event) Something has happened, so handle it.- Specified by:
- handlein interface- Handler<RoutingContext>
- Parameters:
- event- the event to handle
 
 - 
createpublic static StaticHandler create() Create a handler using defaults- Returns:
- the handler
 
 - 
createpublic static StaticHandler create(String root) Create a handler, specifying web-root- Parameters:
- root- the web-root
- Returns:
- the handler
 
 - 
createpublic static StaticHandler create(FileSystemAccess handlerVisibility, String root) Create a handler, specifying web-root and access option: absolute path or relative- Parameters:
- handlerVisibility- CWD or file system root
- root- the web-root
- Returns:
- the handler
 
 - 
setFilesReadOnlypublic StaticHandler setFilesReadOnly(boolean readOnly) 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
 
 - 
setMaxAgeSecondspublic StaticHandler setMaxAgeSeconds(long maxAgeSeconds) 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
 
 - 
setCachingEnabledpublic StaticHandler setCachingEnabled(boolean enabled) Set whether cache header handling is enabled- Parameters:
- enabled- true if enabled
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
setDirectoryListingpublic StaticHandler setDirectoryListing(boolean directoryListing) Set whether directory listing is enabled- Parameters:
- directoryListing- true if enabled
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
setIncludeHiddenpublic StaticHandler setIncludeHidden(boolean includeHidden) 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
 
 - 
setCacheEntryTimeoutpublic StaticHandler setCacheEntryTimeout(long timeout) 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
 
 - 
setIndexPagepublic StaticHandler setIndexPage(String indexPage) Set the index page- Parameters:
- indexPage- the index page
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
setMaxCacheSizepublic StaticHandler setMaxCacheSize(int maxCacheSize) 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
 
 - 
setHttp2PushMappingpublic StaticHandler setHttp2PushMapping(List<Http2PushMapping> http2PushMappings) 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
 
 - 
skipCompressionForMediaTypespublic StaticHandler skipCompressionForMediaTypes(Set<String> mediaTypes) 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
 
 - 
skipCompressionForSuffixespublic StaticHandler skipCompressionForSuffixes(Set<String> fileSuffixes) 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
 
 - 
setAlwaysAsyncFSpublic StaticHandler setAlwaysAsyncFS(boolean alwaysAsyncFS) 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
 
 - 
setEnableFSTuningpublic StaticHandler setEnableFSTuning(boolean enableFSTuning) 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
 
 - 
setMaxAvgServeTimeNspublic StaticHandler setMaxAvgServeTimeNs(long maxAvgServeTimeNanoSeconds) 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
 
 - 
setDirectoryTemplatepublic StaticHandler setDirectoryTemplate(String directoryTemplate) 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
 
 - 
setEnableRangeSupportpublic StaticHandler setEnableRangeSupport(boolean enableRangeSupport) 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
 
 - 
setSendVaryHeaderpublic StaticHandler setSendVaryHeader(boolean varyHeader) 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
 
 - 
setDefaultContentEncodingpublic StaticHandler setDefaultContentEncoding(String contentEncoding) 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
 
 - 
newInstancepublic static StaticHandler newInstance(StaticHandler arg) 
 
- 
 
-