Package cool.scx.web._hack
Class StaticHandlerImpl
java.lang.Object
cool.scx.web._hack.StaticHandlerImpl
- All Implemented Interfaces:
io.vertx.core.Handler<io.vertx.ext.web.RoutingContext>,io.vertx.ext.web.handler.StaticHandler
- Direct Known Subclasses:
SendFileHelper
Copy From
StaticHandlerImpl Make Some private to public so we can Override
Static web server
Parts derived from Yoke- Author:
- Tim Fox, Paulo Lopes, Stephan Wissel
-
Field Summary
Fields inherited from interface io.vertx.ext.web.handler.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 Summary
ConstructorsConstructorDescriptionDefault constructor with DEFAULT_WEB_ROOT and relative file access onlyStaticHandlerImpl(io.vertx.ext.web.handler.FileSystemAccess visibility, String staticRootDirectory) Constructor called by static factory method -
Method Summary
Modifier and TypeMethodDescriptionvoidhandle(io.vertx.ext.web.RoutingContext context) voidsendStatic(io.vertx.ext.web.RoutingContext context, io.vertx.core.file.FileSystem fileSystem, String path, boolean index) Can be called recursive for index pagesio.vertx.ext.web.handler.StaticHandlersetAllowRootFileSystemAccess(boolean allowRootFileSystemAccess) Deprecated.- Use the parameters in constructorio.vertx.ext.web.handler.StaticHandlersetAlwaysAsyncFS(boolean alwaysAsyncFS) io.vertx.ext.web.handler.StaticHandlersetCacheEntryTimeout(long timeout) io.vertx.ext.web.handler.StaticHandlersetCachingEnabled(boolean enabled) io.vertx.ext.web.handler.StaticHandlersetDefaultContentEncoding(String contentEncoding) io.vertx.ext.web.handler.StaticHandlersetDirectoryListing(boolean directoryListing) io.vertx.ext.web.handler.StaticHandlersetDirectoryTemplate(String directoryTemplate) io.vertx.ext.web.handler.StaticHandlersetEnableFSTuning(boolean enableFSTuning) io.vertx.ext.web.handler.StaticHandlersetEnableRangeSupport(boolean enableRangeSupport) io.vertx.ext.web.handler.StaticHandlersetFilesReadOnly(boolean readOnly) io.vertx.ext.web.handler.StaticHandlersetHttp2PushMapping(List<io.vertx.ext.web.Http2PushMapping> http2PushMap) io.vertx.ext.web.handler.StaticHandlersetIncludeHidden(boolean includeHidden) io.vertx.ext.web.handler.StaticHandlersetIndexPage(String indexPage) io.vertx.ext.web.handler.StaticHandlersetMaxAgeSeconds(long maxAgeSeconds) io.vertx.ext.web.handler.StaticHandlersetMaxAvgServeTimeNs(long maxAvgServeTimeNanoSeconds) io.vertx.ext.web.handler.StaticHandlersetMaxCacheSize(int maxCacheSize) io.vertx.ext.web.handler.StaticHandlersetSendVaryHeader(boolean sendVaryHeader) io.vertx.ext.web.handler.StaticHandlersetWebRoot(String webRoot) Deprecated.- Use the parameters in constructorio.vertx.ext.web.handler.StaticHandlerskipCompressionForMediaTypes(Set<String> mediaTypes) io.vertx.ext.web.handler.StaticHandlerskipCompressionForSuffixes(Set<String> fileSuffixes)
-
Constructor Details
-
StaticHandlerImpl
public StaticHandlerImpl(io.vertx.ext.web.handler.FileSystemAccess visibility, String staticRootDirectory) Constructor called by static factory method- Parameters:
visibility- path specified by root is RELATIVE or ROOTstaticRootDirectory- path on host with static file location
-
StaticHandlerImpl
public StaticHandlerImpl()Default constructor with DEFAULT_WEB_ROOT and relative file access only
-
-
Method Details
-
handle
public void handle(io.vertx.ext.web.RoutingContext context) - Specified by:
handlein interfaceio.vertx.core.Handler<io.vertx.ext.web.RoutingContext>
-
sendStatic
public void sendStatic(io.vertx.ext.web.RoutingContext context, io.vertx.core.file.FileSystem fileSystem, String path, boolean index) Can be called recursive for index pages -
setAllowRootFileSystemAccess
@Deprecated public io.vertx.ext.web.handler.StaticHandler setAllowRootFileSystemAccess(boolean allowRootFileSystemAccess) Deprecated.- Use the parameters in constructor- Specified by:
setAllowRootFileSystemAccessin interfaceio.vertx.ext.web.handler.StaticHandler
-
setWebRoot
Deprecated.- Use the parameters in constructor- Specified by:
setWebRootin interfaceio.vertx.ext.web.handler.StaticHandler
-
setFilesReadOnly
public io.vertx.ext.web.handler.StaticHandler setFilesReadOnly(boolean readOnly) - Specified by:
setFilesReadOnlyin interfaceio.vertx.ext.web.handler.StaticHandler
-
setMaxAgeSeconds
public io.vertx.ext.web.handler.StaticHandler setMaxAgeSeconds(long maxAgeSeconds) - Specified by:
setMaxAgeSecondsin interfaceio.vertx.ext.web.handler.StaticHandler
-
setMaxCacheSize
public io.vertx.ext.web.handler.StaticHandler setMaxCacheSize(int maxCacheSize) - Specified by:
setMaxCacheSizein interfaceio.vertx.ext.web.handler.StaticHandler
-
setCachingEnabled
public io.vertx.ext.web.handler.StaticHandler setCachingEnabled(boolean enabled) - Specified by:
setCachingEnabledin interfaceio.vertx.ext.web.handler.StaticHandler
-
setDirectoryListing
public io.vertx.ext.web.handler.StaticHandler setDirectoryListing(boolean directoryListing) - Specified by:
setDirectoryListingin interfaceio.vertx.ext.web.handler.StaticHandler
-
setDirectoryTemplate
- Specified by:
setDirectoryTemplatein interfaceio.vertx.ext.web.handler.StaticHandler
-
setEnableRangeSupport
public io.vertx.ext.web.handler.StaticHandler setEnableRangeSupport(boolean enableRangeSupport) - Specified by:
setEnableRangeSupportin interfaceio.vertx.ext.web.handler.StaticHandler
-
setIncludeHidden
public io.vertx.ext.web.handler.StaticHandler setIncludeHidden(boolean includeHidden) - Specified by:
setIncludeHiddenin interfaceio.vertx.ext.web.handler.StaticHandler
-
setCacheEntryTimeout
public io.vertx.ext.web.handler.StaticHandler setCacheEntryTimeout(long timeout) - Specified by:
setCacheEntryTimeoutin interfaceio.vertx.ext.web.handler.StaticHandler
-
setIndexPage
- Specified by:
setIndexPagein interfaceio.vertx.ext.web.handler.StaticHandler
-
setAlwaysAsyncFS
public io.vertx.ext.web.handler.StaticHandler setAlwaysAsyncFS(boolean alwaysAsyncFS) - Specified by:
setAlwaysAsyncFSin interfaceio.vertx.ext.web.handler.StaticHandler
-
setHttp2PushMapping
public io.vertx.ext.web.handler.StaticHandler setHttp2PushMapping(List<io.vertx.ext.web.Http2PushMapping> http2PushMap) - Specified by:
setHttp2PushMappingin interfaceio.vertx.ext.web.handler.StaticHandler
-
skipCompressionForMediaTypes
- Specified by:
skipCompressionForMediaTypesin interfaceio.vertx.ext.web.handler.StaticHandler
-
skipCompressionForSuffixes
- Specified by:
skipCompressionForSuffixesin interfaceio.vertx.ext.web.handler.StaticHandler
-
setEnableFSTuning
public io.vertx.ext.web.handler.StaticHandler setEnableFSTuning(boolean enableFSTuning) - Specified by:
setEnableFSTuningin interfaceio.vertx.ext.web.handler.StaticHandler
-
setMaxAvgServeTimeNs
public io.vertx.ext.web.handler.StaticHandler setMaxAvgServeTimeNs(long maxAvgServeTimeNanoSeconds) - Specified by:
setMaxAvgServeTimeNsin interfaceio.vertx.ext.web.handler.StaticHandler
-
setSendVaryHeader
public io.vertx.ext.web.handler.StaticHandler setSendVaryHeader(boolean sendVaryHeader) - Specified by:
setSendVaryHeaderin interfaceio.vertx.ext.web.handler.StaticHandler
-
setDefaultContentEncoding
- Specified by:
setDefaultContentEncodingin interfaceio.vertx.ext.web.handler.StaticHandler
-
getFile
-