Module: VertxWebApiContract::RouterFactory

Included in:
RouterFactoryImpl
Defined in:
/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/router_factory.rb

Instance Method Summary (collapse)

Instance Method Details

- (self) add_failure_handler(method = nil, path = nil) { ... }

Add a failure handler to a path with a method. If combination path/method is not available in specification, it will throw a Nil. Deprecated in favour of operation id

Parameters:

  • method (:OPTIONS, :GET, :HEAD, :POST, :PUT, :DELETE, :TRACE, :CONNECT, :PATCH, :OTHER) (defaults to: nil)
  • path (String) (defaults to: nil)

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


39
40
41
42
43
44
45
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/router_factory.rb', line 39

def add_failure_handler(method=nil,path=nil)
  if method.class == Symbol && path.class == String && block_given?
    @j_del.java_method(:addFailureHandler, [Java::IoVertxCoreHttp::HttpMethod.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxCoreHttp::HttpMethod.valueOf(method.to_s),path,(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxWeb::RoutingContext)) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling add_failure_handler(#{method},#{path})"
end

- (self) add_handler(method = nil, path = nil) { ... }

Add an handler to a path with a method. If combination path/method is not available in specification, it will throw a Nil. Deprecated in favour of operation id

Parameters:

  • method (:OPTIONS, :GET, :HEAD, :POST, :PUT, :DELETE, :TRACE, :CONNECT, :PATCH, :OTHER) (defaults to: nil)
  • path (String) (defaults to: nil)

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


25
26
27
28
29
30
31
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/router_factory.rb', line 25

def add_handler(method=nil,path=nil)
  if method.class == Symbol && path.class == String && block_given?
    @j_del.java_method(:addHandler, [Java::IoVertxCoreHttp::HttpMethod.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxCoreHttp::HttpMethod.valueOf(method.to_s),path,(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxWeb::RoutingContext)) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling add_handler(#{method},#{path})"
end

- (self) add_security_handler(securitySchemaName = nil) { ... }

Mount to paths that have to follow a security schema a security handler

Parameters:

  • securitySchemaName (String) (defaults to: nil)

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


11
12
13
14
15
16
17
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/router_factory.rb', line 11

def add_security_handler(securitySchemaName=nil)
  if securitySchemaName.class == String && block_given?
    @j_del.java_method(:addSecurityHandler, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(securitySchemaName,(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxWeb::RoutingContext)) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling add_security_handler(#{securitySchemaName})"
end

- (self) enable_validation_failure_handler(enable = nil)

Deprecated. Instantiate Hash and load it using #set_options

Parameters:

  • enable (true, false) (defaults to: nil)

Returns:

  • (self)

Raises:

  • (ArgumentError)


79
80
81
82
83
84
85
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/router_factory.rb', line 79

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

- (Hash) get_options

Get options of router factory. For more info Hash

Returns:

  • (Hash)

Raises:

  • (ArgumentError)


58
59
60
61
62
63
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/router_factory.rb', line 58

def get_options
  if !block_given?
    return @j_del.java_method(:getOptions, []).call() != nil ? JSON.parse(@j_del.java_method(:getOptions, []).call().toJson.encode) : nil
  end
  raise ArgumentError, "Invalid arguments when calling get_options()"
end

- (::VertxWeb::Router) get_router

Construct a new router based on spec. It will fail if you are trying to mount a spec with security schemes without assigned handlers
Note: Router is constructed in this function, so it will be respected the path definition ordering.

Returns:

Raises:

  • (ArgumentError)


101
102
103
104
105
106
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/router_factory.rb', line 101

def get_router
  if !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:getRouter, []).call(),::VertxWeb::Router)
  end
  raise ArgumentError, "Invalid arguments when calling get_router()"
end

- (self) mount_operations_without_handlers(enable = nil)

Deprecated. Instantiate Hash and load it using #set_options

Parameters:

  • enable (true, false) (defaults to: nil)

Returns:

  • (self)

Raises:

  • (ArgumentError)


90
91
92
93
94
95
96
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/router_factory.rb', line 90

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

- (self) set_options(options = nil)

Override options

Parameters:

  • options (Hash) (defaults to: nil)

Returns:

  • (self)

Raises:

  • (ArgumentError)


49
50
51
52
53
54
55
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/router_factory.rb', line 49

def set_options(options=nil)
  if options.class == Hash && !block_given?
    @j_del.java_method(:setOptions, [Java::IoVertxExtWebApiContract::RouterFactoryOptions.java_class]).call(Java::IoVertxExtWebApiContract::RouterFactoryOptions.new(::Vertx::Util::Utils.to_json_object(options)))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling set_options(#{options})"
end

- (self) set_validation_failure_handler { ... }

Deprecated. Instantiate Hash and load it using #set_options

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


68
69
70
71
72
73
74
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/router_factory.rb', line 68

def set_validation_failure_handler
  if block_given?
    @j_del.java_method(:setValidationFailureHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxWeb::RoutingContext)) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling set_validation_failure_handler()"
end