Package: io.vertx.groovy.ext.web.handler

## [Groovy] Class StaticHandler

- io.vertx.groovy.ext.web.handler.StaticHandler

- All Implemented Interfaces and Traits:
    io.vertx.core.Handler

      @groovy.transform.CompileStatic
      class StaticHandler
      extends java.lang.Object

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

- - ### Constructor Summary

    Constructors
    Constructor and description
    `StaticHandler (java.lang.Object delegate)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `static StaticHandler` | `create()` Create a handler using defaults
    `static StaticHandler` | `create(java.lang.String root)` Create a handler, specifying web-root
    `java.lang.Object` | `getDelegate()`
    `void` | `handle(RoutingContext arg0)`
    `StaticHandler` | `setAllowRootFileSystemAccess(boolean allowRootFileSystemAccess)` Enable/Disable access to the root of the filesystem
    `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` | `setDirectoryListing(boolean directoryListing)` Set whether directory listing is enabled
    `StaticHandler` | `setDirectoryTemplate(java.lang.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` | `setIncludeHidden(boolean includeHidden)` Set whether hidden files should be served
    `StaticHandler` | `setIndexPage(java.lang.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` | `setWebRoot(java.lang.String webRoot)` Set the web root

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Constructor Detail

    - #### StaticHandler(java.lang.Object delegate)

  - ### Method Detail

    - #### static StaticHandler create()

      Create a handler using defaults

      Returns:
        the handler

    - #### static StaticHandler create(java.lang.String root)

      Create a handler, specifying web-root

      Returns:
        the handler
      Parameters:
        `root` - the web-root

    - #### java.lang.Object getDelegate()

    - #### void handle(RoutingContext arg0)

    - #### StaticHandler setAllowRootFileSystemAccess(boolean allowRootFileSystemAccess)

      Enable/Disable access to the root of the filesystem

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `allowRootFileSystemAccess` - whether root access is allowed

    - #### StaticHandler setAlwaysAsyncFS(boolean alwaysAsyncFS)

      Set whether async filesystem access should always be used

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `alwaysAsyncFS` - true for always async FS access

    - #### StaticHandler setCacheEntryTimeout(long timeout)

      Set the server cache entry timeout when caching is enabled

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `timeout` - the timeout, in ms

    - #### StaticHandler setCachingEnabled(boolean enabled)

      Set whether cache header handling is enabled

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `enabled` - true if enabled

    - #### StaticHandler setDirectoryListing(boolean directoryListing)

      Set whether directory listing is enabled

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `directoryListing` - true if enabled

    - #### StaticHandler setDirectoryTemplate(java.lang.String directoryTemplate)

      Set the directory template to be used when directory listing

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `directoryTemplate` - the directory template

    - #### StaticHandler setEnableFSTuning(boolean enableFSTuning)

      Set whether async/sync filesystem tuning should enabled

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `enableFSTuning` - true to enabled FS tuning

    - #### StaticHandler setEnableRangeSupport(boolean enableRangeSupport)

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

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `enableRangeSupport` - true to enable range support

    - #### StaticHandler setFilesReadOnly(boolean readOnly)

      Set whether files are read-only and will never change

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `readOnly` - whether files are read-only

    - #### StaticHandler setIncludeHidden(boolean includeHidden)

      Set whether hidden files should be served

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `includeHidden` - true if hidden files should be served

    - #### StaticHandler setIndexPage(java.lang.String indexPage)

      Set the index page

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `indexPage` - the index page

    - #### StaticHandler setMaxAgeSeconds(long maxAgeSeconds)

      Set value for max age in caching headers

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `maxAgeSeconds` - maximum time for browser to cache, in seconds

    - #### StaticHandler setMaxAvgServeTimeNs(long maxAvgServeTimeNanoSeconds)

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

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `maxAvgServeTimeNanoSeconds` - max serve time, in ns

    - #### StaticHandler setMaxCacheSize(int maxCacheSize)

      Set the max cache size, when caching is enabled

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `maxCacheSize` - the max cache size

    - #### StaticHandler setWebRoot(java.lang.String webRoot)

      Set the web root

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `webRoot` - the web root