Options
All
  • Public
  • Public/Protected
  • All
Menu

Class StaticHandler

A handler for serving static resources from the file system or classpath.

Hierarchy

  • StaticHandler

Implements

  • any

Index

Properties

Static Readonly DEFAULT_ALWAYS_ASYNC_FS

DEFAULT_ALWAYS_ASYNC_FS: boolean

Default of whether async filesystem access should always be used

Static Readonly DEFAULT_CACHE_ENTRY_TIMEOUT

DEFAULT_CACHE_ENTRY_TIMEOUT: number

Default cache entry timeout, when caching

Static Readonly DEFAULT_CACHING_ENABLED

DEFAULT_CACHING_ENABLED: boolean

Default of whether cache header handling is enabled

Static Readonly DEFAULT_DIRECTORY_LISTING

DEFAULT_DIRECTORY_LISTING: boolean

Default of whether directory listing is enabled

Static Readonly DEFAULT_DIRECTORY_TEMPLATE

DEFAULT_DIRECTORY_TEMPLATE: string

Default template file to use for directory listing

Static Readonly DEFAULT_ENABLE_FS_TUNING

DEFAULT_ENABLE_FS_TUNING: boolean

Default of whether fs async/sync tuning should be used

Static Readonly DEFAULT_FILES_READ_ONLY

DEFAULT_FILES_READ_ONLY: boolean

Default value of whether files are read -only and never will be updated

Static Readonly DEFAULT_INCLUDE_HIDDEN

DEFAULT_INCLUDE_HIDDEN: boolean

Default of whether hidden files can be served

Static Readonly DEFAULT_INDEX_PAGE

DEFAULT_INDEX_PAGE: string

The default index page

Static Readonly DEFAULT_MAX_AGE_SECONDS

DEFAULT_MAX_AGE_SECONDS: number

Default max age for cache headers

Static Readonly DEFAULT_MAX_AVG_SERVE_TIME_NS

DEFAULT_MAX_AVG_SERVE_TIME_NS: number

Default max avg serve time, in ns, over which serving will be considered slow

Static Readonly DEFAULT_MAX_CACHE_SIZE

DEFAULT_MAX_CACHE_SIZE: number

The default max cache size

Static Readonly DEFAULT_RANGE_SUPPORT

DEFAULT_RANGE_SUPPORT: boolean

Default of whether Range request handling support should be used

Static Readonly DEFAULT_ROOT_FILESYSTEM_ACCESS

DEFAULT_ROOT_FILESYSTEM_ACCESS: boolean

Default of whether access to the root of the file system should be allowed or just allow from the current working directory.

Static Readonly DEFAULT_SEND_VARY_HEADER

DEFAULT_SEND_VARY_HEADER: boolean

Default of whether vary header should be sent.

Static Readonly DEFAULT_WEB_ROOT

DEFAULT_WEB_ROOT: string

Default value of the web-root, where files are served from

Methods

handle

  • Parameters

    Returns void

setAllowRootFileSystemAccess

  • setAllowRootFileSystemAccess(allowRootFileSystemAccess: boolean): StaticHandler
  • Enable/Disable access to the root of the filesystem

    Parameters

    • allowRootFileSystemAccess: boolean

    Returns StaticHandler

setAlwaysAsyncFS

  • Set whether async filesystem access should always be used

    Parameters

    • alwaysAsyncFS: boolean

    Returns StaticHandler

setCacheEntryTimeout

  • Set the server cache entry timeout when caching is enabled

    Parameters

    • timeout: number

    Returns StaticHandler

setCachingEnabled

  • Set whether cache header handling is enabled

    Parameters

    • enabled: boolean

    Returns StaticHandler

setDefaultContentEncoding

  • setDefaultContentEncoding(contentEncoding: string): StaticHandler
  • Set the default content encoding for text related files. This allows overriding the system settings default value.

    Parameters

    • contentEncoding: string

    Returns StaticHandler

setDirectoryListing

  • Set whether directory listing is enabled

    Parameters

    • directoryListing: boolean

    Returns StaticHandler

setDirectoryTemplate

  • Set the directory template to be used when directory listing

    Parameters

    • directoryTemplate: string

    Returns StaticHandler

setEnableFSTuning

  • Set whether async/sync filesystem tuning should enabled

    Parameters

    • enableFSTuning: boolean

    Returns StaticHandler

setEnableRangeSupport

  • setEnableRangeSupport(enableRangeSupport: boolean): StaticHandler
  • Set whether range requests (resumable downloads; media streaming) should be enabled.

    Parameters

    • enableRangeSupport: boolean

    Returns StaticHandler

setFilesReadOnly

  • Set whether files are read-only and will never change

    Parameters

    • readOnly: boolean

    Returns StaticHandler

setHttp2PushMapping

  • Set the file mapping for http2push and link preload

    Parameters

    Returns StaticHandler

setIncludeHidden

  • Set whether hidden files should be served

    Parameters

    • includeHidden: boolean

    Returns StaticHandler

setIndexPage

  • Set the index page

    Parameters

    • indexPage: string

    Returns StaticHandler

setMaxAgeSeconds

  • Set value for max age in caching headers

    Parameters

    • maxAgeSeconds: number

    Returns StaticHandler

setMaxAvgServeTimeNs

  • setMaxAvgServeTimeNs(maxAvgServeTimeNanoSeconds: number): StaticHandler
  • Set the max serve time in ns, above which serves are considered slow

    Parameters

    • maxAvgServeTimeNanoSeconds: number

    Returns StaticHandler

setMaxCacheSize

  • Set the max cache size, when caching is enabled

    Parameters

    • maxCacheSize: number

    Returns StaticHandler

setSendVaryHeader

  • Set whether vary header should be sent with response.

    Parameters

    • varyHeader: boolean

    Returns StaticHandler

setWebRoot

  • Set the web root

    Parameters

    • webRoot: string

    Returns StaticHandler

skipCompressionForMediaTypes

  • skipCompressionForMediaTypes(mediaTypes: string): StaticHandler
  • Skip compression if the media type of the file to send is in the provided mediaTypes set. Content-Encoding header set to identity for the types present in the mediaTypes set

    Parameters

    • mediaTypes: string

    Returns StaticHandler

skipCompressionForSuffixes

  • skipCompressionForSuffixes(fileSuffixes: string): StaticHandler
  • Skip compression if the suffix of the file to send is in the provided fileSuffixes set. Content-Encoding header set to identity for the suffixes present in the fileSuffixes set

    Parameters

    • fileSuffixes: string

    Returns StaticHandler

Static create

  • Create a handler using defaults

    Returns StaticHandler

  • Create a handler, specifying web-root

    Parameters

    • root: string

    Returns StaticHandler

  • Create a handler, specifying web-root and access option: absolute path or relative

    Parameters

    Returns StaticHandler

Generated using TypeDoc