Class: VertxWeb::FaviconHandler

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/favicon_handler.rb

Overview

A handler that serves favicons.

If no file system path is specified it will attempt to serve a resource called `favicon.ico` from the classpath.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


20
21
22
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/favicon_handler.rb', line 20

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

+ (::VertxWeb::FaviconHandler) create + (::VertxWeb::FaviconHandler) create(path) + (::VertxWeb::FaviconHandler) create(maxAgeSeconds) + (::VertxWeb::FaviconHandler) create(path, maxAgeSeconds)

Create a handler attempting to load favicon file from the specified path, and with the specified max cache time

Overloads:

  • + (::VertxWeb::FaviconHandler) create(path)

    Parameters:

    • path (String)
      the path
  • + (::VertxWeb::FaviconHandler) create(maxAgeSeconds)

    Parameters:

    • maxAgeSeconds (Fixnum)
      max how long the file will be cached by browser, in seconds
  • + (::VertxWeb::FaviconHandler) create(path, maxAgeSeconds)

    Parameters:

    • path (String)
      the path
    • maxAgeSeconds (Fixnum)
      max how long the file will be cached by browser, in seconds

Returns:

Raises:

  • (ArgumentError)


54
55
56
57
58
59
60
61
62
63
64
65
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/favicon_handler.rb', line 54

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

+ (Object) DEFAULT_MAX_AGE_SECONDS

The default max age in seconds as set in the cache-control header


67
68
69
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/favicon_handler.rb', line 67

def self.DEFAULT_MAX_AGE_SECONDS
  Java::IoVertxExtWebHandler::FaviconHandler.DEFAULT_MAX_AGE_SECONDS
end

+ (Object) j_api_type



29
30
31
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/favicon_handler.rb', line 29

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



32
33
34
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/favicon_handler.rb', line 32

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

+ (Object) unwrap(obj)



26
27
28
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/favicon_handler.rb', line 26

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

+ (Object) wrap(obj)



23
24
25
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/favicon_handler.rb', line 23

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

Instance Method Details

- (void) handle(event = nil)

This method returns an undefined value.

Something has happened, so handle it.

Parameters:

Raises:

  • (ArgumentError)


38
39
40
41
42
43
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/favicon_handler.rb', line 38

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