# Class: StaticHandler

## vertx-web-js/static_handler~ StaticHandler

#### new StaticHandler()

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

Source:
  - vertx-web-js/static_handler.js, line 31

### Methods

#### handle(arg0)

##### Parameters:

Name | Type | Description
--- | --- | ---
`arg0` | RoutingContext |

Source:
  - vertx-web-js/static_handler.js, line 41

#### setAllowRootFileSystemAccess(allowRootFileSystemAccess) → {StaticHandler}

Enable/Disable access to the root of the filesystem

##### Parameters:

Name | Type | Description
--- | --- | ---
`allowRootFileSystemAccess` | boolean | whether root access is allowed

Source:
  - vertx-web-js/static_handler.js, line 55

##### Returns:

a reference to this, so the API can be used fluently

Type
  StaticHandler

#### setAlwaysAsyncFS(alwaysAsyncFS) → {StaticHandler}

Set whether async filesystem access should always be used

##### Parameters:

Name | Type | Description
--- | --- | ---
`alwaysAsyncFS` | boolean | true for always async FS access

Source:
  - vertx-web-js/static_handler.js, line 220

##### Returns:

a reference to this, so the API can be used fluently

Type
  StaticHandler

#### setCacheEntryTimeout(timeout) → {StaticHandler}

Set the server cache entry timeout when caching is enabled

##### Parameters:

Name | Type | Description
--- | --- | ---
`timeout` | number | the timeout, in ms

Source:
  - vertx-web-js/static_handler.js, line 160

##### Returns:

a reference to this, so the API can be used fluently

Type
  StaticHandler

#### setCachingEnabled(enabled) → {StaticHandler}

Set whether cache header handling is enabled

##### Parameters:

Name | Type | Description
--- | --- | ---
`enabled` | boolean | true if enabled

Source:
  - vertx-web-js/static_handler.js, line 115

##### Returns:

a reference to this, so the API can be used fluently

Type
  StaticHandler

#### setDefaultContentEncoding(contentEncoding) → {StaticHandler}

Set the default content encoding for text related files. This allows overriding the system settings default value.

##### Parameters:

Name | Type | Description
--- | --- | ---
`contentEncoding` | string | the desired content encoding e.g.: "UTF-8"

Source:
  - vertx-web-js/static_handler.js, line 310

##### Returns:

a reference to this, so the API can be used fluently

Type
  StaticHandler

#### setDirectoryListing(directoryListing) → {StaticHandler}

Set whether directory listing is enabled

##### Parameters:

Name | Type | Description
--- | --- | ---
`directoryListing` | boolean | true if enabled

Source:
  - vertx-web-js/static_handler.js, line 130

##### Returns:

a reference to this, so the API can be used fluently

Type
  StaticHandler

#### setDirectoryTemplate(directoryTemplate) → {StaticHandler}

Set the directory template to be used when directory listing

##### Parameters:

Name | Type | Description
--- | --- | ---
`directoryTemplate` | string | the directory template

Source:
  - vertx-web-js/static_handler.js, line 265

##### Returns:

a reference to this, so the API can be used fluently

Type
  StaticHandler

#### setEnableFSTuning(enableFSTuning) → {StaticHandler}

Set whether async/sync filesystem tuning should enabled

##### Parameters:

Name | Type | Description
--- | --- | ---
`enableFSTuning` | boolean | true to enabled FS tuning

Source:
  - vertx-web-js/static_handler.js, line 235

##### Returns:

a reference to this, so the API can be used fluently

Type
  StaticHandler

#### setEnableRangeSupport(enableRangeSupport) → {StaticHandler}

Set whether range requests (resumable downloads; media streaming) should be enabled.

##### Parameters:

Name | Type | Description
--- | --- | ---
`enableRangeSupport` | boolean | true to enable range support

Source:
  - vertx-web-js/static_handler.js, line 280

##### Returns:

a reference to this, so the API can be used fluently

Type
  StaticHandler

#### setFilesReadOnly(readOnly) → {StaticHandler}

Set whether files are read-only and will never change

##### Parameters:

Name | Type | Description
--- | --- | ---
`readOnly` | boolean | whether files are read-only

Source:
  - vertx-web-js/static_handler.js, line 85

##### Returns:

a reference to this, so the API can be used fluently

Type
  StaticHandler

#### setHttp2PushMapping(http2PushMappings) → {StaticHandler}

Set the file mapping for http2push and link preload

##### Parameters:

Name | Type | Description
--- | --- | ---
`http2PushMappings` | Array.<Object> | the mapping for http2 push

Source:
  - vertx-web-js/static_handler.js, line 205

##### Returns:

a reference to this, so the API can be used fluently

Type
  StaticHandler

#### setIncludeHidden(includeHidden) → {StaticHandler}

Set whether hidden files should be served

##### Parameters:

Name | Type | Description
--- | --- | ---
`includeHidden` | boolean | true if hidden files should be served

Source:
  - vertx-web-js/static_handler.js, line 145

##### Returns:

a reference to this, so the API can be used fluently

Type
  StaticHandler

#### setIndexPage(indexPage) → {StaticHandler}

Set the index page

##### Parameters:

Name | Type | Description
--- | --- | ---
`indexPage` | string | the index page

Source:
  - vertx-web-js/static_handler.js, line 175

##### Returns:

a reference to this, so the API can be used fluently

Type
  StaticHandler

#### setMaxAgeSeconds(maxAgeSeconds) → {StaticHandler}

Set value for max age in caching headers

##### Parameters:

Name | Type | Description
--- | --- | ---
`maxAgeSeconds` | number | maximum time for browser to cache, in seconds

Source:
  - vertx-web-js/static_handler.js, line 100

##### Returns:

a reference to this, so the API can be used fluently

Type
  StaticHandler

#### setMaxAvgServeTimeNs(maxAvgServeTimeNanoSeconds) → {StaticHandler}

Set the max serve time in ns, above which serves are considered slow

##### Parameters:

Name | Type | Description
--- | --- | ---
`maxAvgServeTimeNanoSeconds` | number | max serve time, in ns

Source:
  - vertx-web-js/static_handler.js, line 250

##### Returns:

a reference to this, so the API can be used fluently

Type
  StaticHandler

#### setMaxCacheSize(maxCacheSize) → {StaticHandler}

Set the max cache size, when caching is enabled

##### Parameters:

Name | Type | Description
--- | --- | ---
`maxCacheSize` | number | the max cache size

Source:
  - vertx-web-js/static_handler.js, line 190

##### Returns:

a reference to this, so the API can be used fluently

Type
  StaticHandler

#### setSendVaryHeader(varyHeader) → {StaticHandler}

Set whether vary header should be sent with response.

##### Parameters:

Name | Type | Description
--- | --- | ---
`varyHeader` | boolean | true to sent vary header

Source:
  - vertx-web-js/static_handler.js, line 295

##### Returns:

a reference to this, so the API can be used fluently

Type
  StaticHandler

#### setWebRoot(webRoot) → {StaticHandler}

Set the web root

##### Parameters:

Name | Type | Description
--- | --- | ---
`webRoot` | string | the web root

Source:
  - vertx-web-js/static_handler.js, line 70

##### Returns:

a reference to this, so the API can be used fluently

Type
  StaticHandler