Class List Method List File List

# Class: VertxWeb::StaticHandler

Inherits:
  Object
  - Object
  - VertxWeb::StaticHandler
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb

## Overview

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

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (::VertxWeb::StaticHandler) create(root = nil)
  Create a handler, specifying web-root.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (void) handle(arg0 = nil)
- - (self) set_allow_root_file_system_access(allowRootFileSystemAccess = nil)
  Enable/Disable access to the root of the filesystem.
- - (self) set_always_async_fs(alwaysAsyncFS = nil)
  Set whether async filesystem access should always be used.
- - (self) set_cache_entry_timeout(timeout = nil)
  Set the server cache entry timeout when caching is enabled.
- - (self) set_caching_enabled(enabled = nil)
  Set whether cache header handling is enabled.
- - (self) set_default_content_encoding(contentEncoding = nil)
  Set the default content encoding for text related files.
- - (self) set_directory_listing(directoryListing = nil)
  Set whether directory listing is enabled.
- - (self) set_directory_template(directoryTemplate = nil)
  Set the directory template to be used when directory listing.
- - (self) set_enable_fs_tuning(enableFSTuning = nil)
  Set whether async/sync filesystem tuning should enabled.
- - (self) set_enable_range_support(enableRangeSupport = nil)
  Set whether range requests (resumable downloads; media streaming) should be enabled.
- - (self) set_files_read_only(readOnly = nil)
  Set whether files are read-only and will never change.
- - (self) set_include_hidden(includeHidden = nil)
  Set whether hidden files should be served.
- - (self) set_index_page(indexPage = nil)
  Set the index page.
- - (self) set_max_age_seconds(maxAgeSeconds = nil)
  Set value for max age in caching headers.
- - (self) set_max_avg_serve_time_ns(maxAvgServeTimeNanoSeconds = nil)
  Set the max serve time in ns, above which serves are considered slow.
- - (self) set_max_cache_size(maxCacheSize = nil)
  Set the max cache size, when caching is enabled.
- - (self) set_send_vary_header(varyHeader = nil)
  Set whether vary header should be sent with response.
- - (self) set_web_root(webRoot = nil)
  Set the web root.

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

    18
    19
    20
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 18

    def @@j_api_type.accept?(obj)
      obj.class == StaticHandler
    end

### + (`::VertxWeb::StaticHandler`) create(root = nil)

Create a handler, specifying web-root

Parameters:

- root (`String`) (defaults to: `nil`) —
  the web-root

Returns:

- (`::VertxWeb::StaticHandler`) —
  the handler

Raises:

- (`ArgumentError`)

    44
    45
    46
    47
    48
    49
    50
    51
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 44

    def self.create(root=nil)
      if !block_given? && root == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::StaticHandler.java_method(:create, []).call(),::VertxWeb::StaticHandler)
      elsif root.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::StaticHandler.java_method(:create, [Java::java.lang.String.java_class]).call(root),::VertxWeb::StaticHandler)
      end
      raise ArgumentError, "Invalid arguments when calling create(#{root})"
    end

### + (`Object`) j_api_type

    27
    28
    29
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 27

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    30
    31
    32
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 30

    def self.j_class
      Java::IoVertxExtWebHandler::StaticHandler.java_class
    end

### + (`Object`) unwrap(obj)

    24
    25
    26
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 24

    def @@j_api_type.unwrap(obj)
      obj.j_del
    end

### + (`Object`) wrap(obj)

    21
    22
    23
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 21

    def @@j_api_type.wrap(obj)
      StaticHandler.new(obj)
    end

## Instance Method Details

### - (`void`) handle(arg0 = nil)

This method returns an undefined value.

Parameters:

- arg0 (`::VertxWeb::RoutingContext`) (defaults to: `nil`)

Raises:

- (`ArgumentError`)

    35
    36
    37
    38
    39
    40
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 35

    def handle(arg0=nil)
      if arg0.class.method_defined?(:j_del) && !block_given?
        return @j_del.java_method(:handle, [Java::IoVertxExtWeb::RoutingContext.java_class]).call(arg0.j_del)
      end
      raise ArgumentError, "Invalid arguments when calling handle(#{arg0})"
    end

### - (`self`) set_allow_root_file_system_access(allowRootFileSystemAccess = nil)

Enable/Disable access to the root of the filesystem

Parameters:

- allowRootFileSystemAccess (`true`, `false`) (defaults to: `nil`) —
  whether root access is allowed

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    55
    56
    57
    58
    59
    60
    61
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 55

    def set_allow_root_file_system_access(allowRootFileSystemAccess=nil)
      if (allowRootFileSystemAccess.class == TrueClass || allowRootFileSystemAccess.class == FalseClass) && !block_given?
        @j_del.java_method(:setAllowRootFileSystemAccess, [Java::boolean.java_class]).call(allowRootFileSystemAccess)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_allow_root_file_system_access(#{allowRootFileSystemAccess})"
    end

### - (`self`) set_always_async_fs(alwaysAsyncFS = nil)

Set whether async filesystem access should always be used

Parameters:

- alwaysAsyncFS (`true`, `false`) (defaults to: `nil`) —
  true for always async FS access

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    155
    156
    157
    158
    159
    160
    161
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 155

    def set_always_async_fs(alwaysAsyncFS=nil)
      if (alwaysAsyncFS.class == TrueClass || alwaysAsyncFS.class == FalseClass) && !block_given?
        @j_del.java_method(:setAlwaysAsyncFS, [Java::boolean.java_class]).call(alwaysAsyncFS)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_always_async_fs(#{alwaysAsyncFS})"
    end

### - (`self`) set_cache_entry_timeout(timeout = nil)

Set the server cache entry timeout when caching is enabled

Parameters:

- timeout (`Fixnum`) (defaults to: `nil`) —
  the timeout, in ms

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    125
    126
    127
    128
    129
    130
    131
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 125

    def set_cache_entry_timeout(timeout=nil)
      if timeout.class == Fixnum && !block_given?
        @j_del.java_method(:setCacheEntryTimeout, [Java::long.java_class]).call(timeout)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_cache_entry_timeout(#{timeout})"
    end

### - (`self`) set_caching_enabled(enabled = nil)

Set whether cache header handling is enabled

Parameters:

- enabled (`true`, `false`) (defaults to: `nil`) —
  true if enabled

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    95
    96
    97
    98
    99
    100
    101
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 95

    def set_caching_enabled(enabled=nil)
      if (enabled.class == TrueClass || enabled.class == FalseClass) && !block_given?
        @j_del.java_method(:setCachingEnabled, [Java::boolean.java_class]).call(enabled)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_caching_enabled(#{enabled})"
    end

### - (`self`) set_default_content_encoding(contentEncoding = nil)

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

Parameters:

- contentEncoding (`String`) (defaults to: `nil`) —
  the desired content encoding e.g.: "UTF-8"

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    215
    216
    217
    218
    219
    220
    221
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 215

    def set_default_content_encoding(contentEncoding=nil)
      if contentEncoding.class == String && !block_given?
        @j_del.java_method(:setDefaultContentEncoding, [Java::java.lang.String.java_class]).call(contentEncoding)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_default_content_encoding(#{contentEncoding})"
    end

### - (`self`) set_directory_listing(directoryListing = nil)

Set whether directory listing is enabled

Parameters:

- directoryListing (`true`, `false`) (defaults to: `nil`) —
  true if enabled

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    105
    106
    107
    108
    109
    110
    111
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 105

    def set_directory_listing(directoryListing=nil)
      if (directoryListing.class == TrueClass || directoryListing.class == FalseClass) && !block_given?
        @j_del.java_method(:setDirectoryListing, [Java::boolean.java_class]).call(directoryListing)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_directory_listing(#{directoryListing})"
    end

### - (`self`) set_directory_template(directoryTemplate = nil)

Set the directory template to be used when directory listing

Parameters:

- directoryTemplate (`String`) (defaults to: `nil`) —
  the directory template

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    185
    186
    187
    188
    189
    190
    191
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 185

    def set_directory_template(directoryTemplate=nil)
      if directoryTemplate.class == String && !block_given?
        @j_del.java_method(:setDirectoryTemplate, [Java::java.lang.String.java_class]).call(directoryTemplate)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_directory_template(#{directoryTemplate})"
    end

### - (`self`) set_enable_fs_tuning(enableFSTuning = nil)

Set whether async/sync filesystem tuning should enabled

Parameters:

- enableFSTuning (`true`, `false`) (defaults to: `nil`) —
  true to enabled FS tuning

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    165
    166
    167
    168
    169
    170
    171
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 165

    def set_enable_fs_tuning(enableFSTuning=nil)
      if (enableFSTuning.class == TrueClass || enableFSTuning.class == FalseClass) && !block_given?
        @j_del.java_method(:setEnableFSTuning, [Java::boolean.java_class]).call(enableFSTuning)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_enable_fs_tuning(#{enableFSTuning})"
    end

### - (`self`) set_enable_range_support(enableRangeSupport = nil)

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

Parameters:

- enableRangeSupport (`true`, `false`) (defaults to: `nil`) —
  true to enable range support

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    195
    196
    197
    198
    199
    200
    201
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 195

    def set_enable_range_support(enableRangeSupport=nil)
      if (enableRangeSupport.class == TrueClass || enableRangeSupport.class == FalseClass) && !block_given?
        @j_del.java_method(:setEnableRangeSupport, [Java::boolean.java_class]).call(enableRangeSupport)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_enable_range_support(#{enableRangeSupport})"
    end

### - (`self`) set_files_read_only(readOnly = nil)

Set whether files are read-only and will never change

Parameters:

- readOnly (`true`, `false`) (defaults to: `nil`) —
  whether files are read-only

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    75
    76
    77
    78
    79
    80
    81
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 75

    def set_files_read_only(readOnly=nil)
      if (readOnly.class == TrueClass || readOnly.class == FalseClass) && !block_given?
        @j_del.java_method(:setFilesReadOnly, [Java::boolean.java_class]).call(readOnly)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_files_read_only(#{readOnly})"
    end

### - (`self`) set_include_hidden(includeHidden = nil)

Set whether hidden files should be served

Parameters:

- includeHidden (`true`, `false`) (defaults to: `nil`) —
  true if hidden files should be served

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    115
    116
    117
    118
    119
    120
    121
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 115

    def set_include_hidden(includeHidden=nil)
      if (includeHidden.class == TrueClass || includeHidden.class == FalseClass) && !block_given?
        @j_del.java_method(:setIncludeHidden, [Java::boolean.java_class]).call(includeHidden)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_include_hidden(#{includeHidden})"
    end

### - (`self`) set_index_page(indexPage = nil)

Set the index page

Parameters:

- indexPage (`String`) (defaults to: `nil`) —
  the index page

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    135
    136
    137
    138
    139
    140
    141
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 135

    def set_index_page(indexPage=nil)
      if indexPage.class == String && !block_given?
        @j_del.java_method(:setIndexPage, [Java::java.lang.String.java_class]).call(indexPage)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_index_page(#{indexPage})"
    end

### - (`self`) set_max_age_seconds(maxAgeSeconds = nil)

Set value for max age in caching headers

Parameters:

- maxAgeSeconds (`Fixnum`) (defaults to: `nil`) —
  maximum time for browser to cache, in seconds

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    85
    86
    87
    88
    89
    90
    91
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 85

    def set_max_age_seconds(maxAgeSeconds=nil)
      if maxAgeSeconds.class == Fixnum && !block_given?
        @j_del.java_method(:setMaxAgeSeconds, [Java::long.java_class]).call(maxAgeSeconds)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_max_age_seconds(#{maxAgeSeconds})"
    end

### - (`self`) set_max_avg_serve_time_ns(maxAvgServeTimeNanoSeconds = nil)

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

Parameters:

- maxAvgServeTimeNanoSeconds (`Fixnum`) (defaults to: `nil`) —
  max serve time, in ns

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    175
    176
    177
    178
    179
    180
    181
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 175

    def set_max_avg_serve_time_ns(maxAvgServeTimeNanoSeconds=nil)
      if maxAvgServeTimeNanoSeconds.class == Fixnum && !block_given?
        @j_del.java_method(:setMaxAvgServeTimeNs, [Java::long.java_class]).call(maxAvgServeTimeNanoSeconds)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_max_avg_serve_time_ns(#{maxAvgServeTimeNanoSeconds})"
    end

### - (`self`) set_max_cache_size(maxCacheSize = nil)

Set the max cache size, when caching is enabled

Parameters:

- maxCacheSize (`Fixnum`) (defaults to: `nil`) —
  the max cache size

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    145
    146
    147
    148
    149
    150
    151
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 145

    def set_max_cache_size(maxCacheSize=nil)
      if maxCacheSize.class == Fixnum && !block_given?
        @j_del.java_method(:setMaxCacheSize, [Java::int.java_class]).call(maxCacheSize)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_max_cache_size(#{maxCacheSize})"
    end

### - (`self`) set_send_vary_header(varyHeader = nil)

Set whether vary header should be sent with response.

Parameters:

- varyHeader (`true`, `false`) (defaults to: `nil`) —
  true to sent vary header

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    205
    206
    207
    208
    209
    210
    211
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 205

    def set_send_vary_header(varyHeader=nil)
      if (varyHeader.class == TrueClass || varyHeader.class == FalseClass) && !block_given?
        @j_del.java_method(:setSendVaryHeader, [Java::boolean.java_class]).call(varyHeader)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_send_vary_header(#{varyHeader})"
    end

### - (`self`) set_web_root(webRoot = nil)

Set the web root

Parameters:

- webRoot (`String`) (defaults to: `nil`) —
  the web root

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    65
    66
    67
    68
    69
    70
    71
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/static_handler.rb', line 65

    def set_web_root(webRoot=nil)
      if webRoot.class == String && !block_given?
        @j_del.java_method(:setWebRoot, [Java::java.lang.String.java_class]).call(webRoot)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_web_root(#{webRoot})"
    end