Class List Method List File List

# Class: VertxWeb::StaticHandler

Inherits:
  Object
  - Object
  - VertxWeb::StaticHandler
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/static_handler.rb

## Overview

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

## Class Method Summary (collapse)

- + (::VertxWeb::StaticHandler) create(root = nil)
  Create a handler, specifying web-root.

## Instance Method Summary (collapse)

- - (void) handle(arg0 = nil)
- - (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_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_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_web_root(webRoot = nil)
  Set the web root.

## Class Method Details

### + (`::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`)

    28
    29
    30
    31
    32
    33
    34
    35
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/static_handler.rb', line 28

    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

## Instance Method Details

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

This method returns an undefined value.

Parameters:

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

Raises:

- (`ArgumentError`)

    19
    20
    21
    22
    23
    24
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/static_handler.rb', line 19

    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_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`)

    129
    130
    131
    132
    133
    134
    135
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/static_handler.rb', line 129

    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`)

    99
    100
    101
    102
    103
    104
    105
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/static_handler.rb', line 99

    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`)

    69
    70
    71
    72
    73
    74
    75
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/static_handler.rb', line 69

    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_directory_listing(directoryListing = nil)

Set whether directory listing is enabled

Parameters:

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

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    79
    80
    81
    82
    83
    84
    85
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/static_handler.rb', line 79

    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`)

    159
    160
    161
    162
    163
    164
    165
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/static_handler.rb', line 159

    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`)

    139
    140
    141
    142
    143
    144
    145
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/static_handler.rb', line 139

    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_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`)

    49
    50
    51
    52
    53
    54
    55
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/static_handler.rb', line 49

    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`)

    89
    90
    91
    92
    93
    94
    95
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/static_handler.rb', line 89

    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`)

    109
    110
    111
    112
    113
    114
    115
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/static_handler.rb', line 109

    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`)

    59
    60
    61
    62
    63
    64
    65
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/static_handler.rb', line 59

    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`)

    149
    150
    151
    152
    153
    154
    155
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/static_handler.rb', line 149

    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`)

    119
    120
    121
    122
    123
    124
    125
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/static_handler.rb', line 119

    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_web_root(webRoot = nil)

Set the web root

Parameters:

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

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    39
    40
    41
    42
    43
    44
    45
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/static_handler.rb', line 39

    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