Class: VertxWeb::ResponseContentTypeHandler

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

Overview

A handler which sets the response content type automatically according to the best Accept header match. The header is set only if:
  • no object is stored in the routing context under the name DEFAULT_DISABLE_FLAG
  • a match is found
  • the header is not present already
  • content length header is absent or set to something different than zero

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


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

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

+ (::VertxWeb::ResponseContentTypeHandler) create + (::VertxWeb::ResponseContentTypeHandler) create(disableFlag)

Create a response content type handler with a custom disable flag.

Overloads:

Returns:



47
48
49
50
51
52
53
54
55
56
57
58
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/response_content_type_handler.rb', line 47

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

+ (Object) DEFAULT_DISABLE_FLAG



73
74
75
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/response_content_type_handler.rb', line 73

def self.DEFAULT_DISABLE_FLAG
  Java::IoVertxExtWebHandler::ResponseContentTypeHandler.DEFAULT_DISABLE_FLAG
end

+ (Object) j_api_type



36
37
38
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/response_content_type_handler.rb', line 36

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



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

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

+ (Object) unwrap(obj)



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

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

+ (Object) wrap(obj)



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

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

Instance Method Details

- (void) handle(event)

This method returns an undefined value.

Something has happened, so handle it.

Parameters:



63
64
65
66
67
68
69
70
71
72
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/response_content_type_handler.rb', line 63

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