public class StaticHandler extends Object implements Handler<RoutingContext>
original
non RX-ified interface using Vert.x codegen.Modifier and Type | Field and Description |
---|---|
static io.vertx.lang.rx.TypeArg<StaticHandler> |
__TYPE_ARG |
static boolean |
DEFAULT_ALWAYS_ASYNC_FS
Default of whether async filesystem access should always be used
|
static long |
DEFAULT_CACHE_ENTRY_TIMEOUT
Default cache entry timeout, when caching
|
static boolean |
DEFAULT_CACHING_ENABLED
Default of whether cache header handling is enabled
|
static boolean |
DEFAULT_DIRECTORY_LISTING
Default of whether directory listing is enabled
|
static String |
DEFAULT_DIRECTORY_TEMPLATE
Default template file to use for directory listing
|
static boolean |
DEFAULT_ENABLE_FS_TUNING
Default of whether fs async/sync tuning should be used
|
static boolean |
DEFAULT_FILES_READ_ONLY
Default value of whether files are read -only and never will be updated
|
static boolean |
DEFAULT_INCLUDE_HIDDEN
Default of whether hidden files can be served
|
static String |
DEFAULT_INDEX_PAGE
The default index page
|
static long |
DEFAULT_MAX_AGE_SECONDS
Default max age for cache headers
|
static long |
DEFAULT_MAX_AVG_SERVE_TIME_NS
Default max avg serve time, in ns, over which serving will be considered slow
|
static int |
DEFAULT_MAX_CACHE_SIZE
The default max cache size
|
static boolean |
DEFAULT_RANGE_SUPPORT
Default of whether Range request handling support should be used
|
static 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.
|
static boolean |
DEFAULT_SEND_VARY_HEADER
Default of whether vary header should be sent.
|
static String |
DEFAULT_WEB_ROOT
Default value of the web-root, where files are served from
|
Constructor and Description |
---|
StaticHandler(Object delegate) |
StaticHandler(StaticHandler delegate) |
Modifier and Type | Method and Description |
---|---|
static StaticHandler |
create()
Create a handler using defaults
|
static StaticHandler |
create(FileSystemAccess handlerVisibility,
String root)
Create a handler, specifying web-root
and access option: absolute path or relative
|
static StaticHandler |
create(String root)
Create a handler, specifying web-root
|
boolean |
equals(Object o) |
StaticHandler |
getDelegate() |
void |
handle(RoutingContext event)
Something has happened, so handle it.
|
int |
hashCode() |
static StaticHandler |
newInstance(StaticHandler arg) |
StaticHandler |
setAllowRootFileSystemAccess(boolean allowRootFileSystemAccess)
Deprecated.
|
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> http2PushMappings)
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 varyHeader)
Set whether vary header should be sent with response.
|
StaticHandler |
setWebRoot(String webRoot)
Deprecated.
|
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. |
String |
toString() |
public static final io.vertx.lang.rx.TypeArg<StaticHandler> __TYPE_ARG
public static final String DEFAULT_WEB_ROOT
public static final boolean DEFAULT_FILES_READ_ONLY
public static final long DEFAULT_MAX_AGE_SECONDS
public static final boolean DEFAULT_CACHING_ENABLED
public static final boolean DEFAULT_DIRECTORY_LISTING
public static final String DEFAULT_DIRECTORY_TEMPLATE
public static final boolean DEFAULT_INCLUDE_HIDDEN
public static final long DEFAULT_CACHE_ENTRY_TIMEOUT
public static final String DEFAULT_INDEX_PAGE
public static final int DEFAULT_MAX_CACHE_SIZE
public static final boolean DEFAULT_ALWAYS_ASYNC_FS
public static final boolean DEFAULT_ENABLE_FS_TUNING
public static final long DEFAULT_MAX_AVG_SERVE_TIME_NS
public static final boolean DEFAULT_RANGE_SUPPORT
public static final boolean DEFAULT_ROOT_FILESYSTEM_ACCESS
public static final boolean DEFAULT_SEND_VARY_HEADER
public StaticHandler(StaticHandler delegate)
public StaticHandler(Object delegate)
public StaticHandler getDelegate()
public void handle(RoutingContext event)
handle
in interface Handler<RoutingContext>
event
- the event to handlepublic static StaticHandler create()
public static StaticHandler create(String root)
root
- the web-rootpublic static StaticHandler create(FileSystemAccess handlerVisibility, String root)
handlerVisibility
- CWD or file system rootroot
- the web-root@Deprecated public StaticHandler setAllowRootFileSystemAccess(boolean allowRootFileSystemAccess)
allowRootFileSystemAccess
- whether root access is allowed@Deprecated public StaticHandler setWebRoot(String webRoot)
webRoot
- the web rootpublic StaticHandler setFilesReadOnly(boolean readOnly)
readOnly
- whether files are read-onlypublic StaticHandler setMaxAgeSeconds(long maxAgeSeconds)
maxAgeSeconds
- maximum time for browser to cache, in secondspublic StaticHandler setCachingEnabled(boolean enabled)
enabled
- true if enabledpublic StaticHandler setDirectoryListing(boolean directoryListing)
directoryListing
- true if enabledpublic StaticHandler setIncludeHidden(boolean includeHidden)
includeHidden
- true if hidden files should be servedpublic StaticHandler setCacheEntryTimeout(long timeout)
timeout
- the timeout, in mspublic StaticHandler setIndexPage(String indexPage)
indexPage
- the index pagepublic StaticHandler setMaxCacheSize(int maxCacheSize)
maxCacheSize
- the max cache sizepublic StaticHandler setHttp2PushMapping(List<Http2PushMapping> http2PushMappings)
http2PushMappings
- the mapping for http2 pushpublic StaticHandler skipCompressionForMediaTypes(Set<String> mediaTypes)
mediaTypes
set.
Content-Encoding
header set to identity
for the types present
in the mediaTypes
setmediaTypes
- the set of mime types that are already compressedpublic StaticHandler skipCompressionForSuffixes(Set<String> fileSuffixes)
fileSuffixes
set.
Content-Encoding
header set to identity
for the suffixes
present in the fileSuffixes
setfileSuffixes
- the set of file suffixes that are already compressedpublic StaticHandler setAlwaysAsyncFS(boolean alwaysAsyncFS)
alwaysAsyncFS
- true for always async FS accesspublic StaticHandler setEnableFSTuning(boolean enableFSTuning)
enableFSTuning
- true to enabled FS tuningpublic StaticHandler setMaxAvgServeTimeNs(long maxAvgServeTimeNanoSeconds)
maxAvgServeTimeNanoSeconds
- max serve time, in nspublic StaticHandler setDirectoryTemplate(String directoryTemplate)
directoryTemplate
- the directory templatepublic StaticHandler setEnableRangeSupport(boolean enableRangeSupport)
enableRangeSupport
- true to enable range supportpublic StaticHandler setSendVaryHeader(boolean varyHeader)
varyHeader
- true to sent vary headerpublic StaticHandler setDefaultContentEncoding(String contentEncoding)
contentEncoding
- the desired content encoding e.g.: "UTF-8"public static StaticHandler newInstance(StaticHandler arg)
Copyright © 2024 Eclipse. All rights reserved.