Class List Method List File List

# Class: VertxWeb::RoutingContext

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

## Overview

Represents the context for the handling of a request in Vert.x-Web.

A new instance is created for each HTTP request that is received in the VertxWeb::Router#accept of the router.

The same instance is passed to any matching request or failure handlers during the routing of the request or failure.

The context provides access to the and and allows you to maintain arbitrary data that lives for the lifetime of the context. Contexts are discarded once they have been routed to the handler for the request.

The context also provides access to the Session, cookies and body for the request, given the correct handlers in the application.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (Array<::VertxWeb::LanguageHeader>) acceptable_languages
  Returns the languages for the current request.
- - (Array<::VertxWeb::Locale>) acceptable_locales
  Returns the locales for the current request.
- - (Fixnum) add_body_end_handler { ... }
  Provides a handler that will be called after the last part of the body is written to the wire.
- - (self) add_cookie(cookie = nil)
  Add a cookie.
- - (Fixnum) add_headers_end_handler { ... }
  Add a handler that will be called just before headers are written to the response.
- - (void) clear_user
  Clear the current user object in the context.
- - (Fixnum) cookie_count
  The number of cookies.
- - (Set<::VertxWeb::Cookie>) cookies
  A set of all the cookies.
- - (::VertxWeb::Route) current_route
  The current route this context is being routed through.
- - (void) fail(param_1 = nil)
  Fail the context with the specified throwable.
- - (true, false) failed
  True if the context is being routed to failure handlers.
- - (Exception) failure
  If the context is being routed to failure handlers after a failure has been triggered by calling #fail then this will return that throwable.
- - (Set<::VertxWeb::FileUpload>) file_uploads
  A set of fileuploads (if any) for the request.
- - (Object) get(key = nil)
  Get some data from the context.
- - (String) get_acceptable_content_type
  If the route specifies produces matches, e.g.
- - (::Vertx::Buffer) get_body
  Get the entire HTTP request body as a .
- - (Hash{String => Object}) get_body_as_json
  Get the entire HTTP request body as a .
- - (Array<String,Object>) get_body_as_json_array
  Get the entire HTTP request body as a .
- - (String) get_body_as_string(encoding = nil)
  Get the entire HTTP request body as a string, assuming the specified encoding.
- - (::VertxWeb::Cookie) get_cookie(name = nil)
  Get the cookie with the specified name.
- - (String) mount_point
  The mount point for this router.
- - (void) next
  Tell the router to route this context to the next matching route (if any).
- - (String) normalised_path
  Return the normalised path for the request.
- - (::VertxWeb::ParsedHeaderValues) parsed_headers
  The headers: Accept Accept-Charset Accept-Encoding Accept-Language Content-Type Parsed into ParsedHeaderValue.
- - (String) path_param(name = nil)
  Gets the value of a single path parameter.
- - (Hash{String => String}) path_params
  Returns a map of named parameters as defined in path declaration with their actual values.
- - (::VertxWeb::LanguageHeader) preferred_language
  Helper to return the user preferred language.
- - (::VertxWeb::Locale) preferred_locale
  Helper to return the user preferred locale.
- - (self) put(key = nil, obj = nil)
  Put some arbitrary data in the context.
- - (Object) remove(key = nil)
  Remove some data from the context.
- - (true, false) remove_body_end_handler(handlerID = nil)
  Remove a body end handler.
- - (::VertxWeb::Cookie) remove_cookie(name = nil)
  Remove a cookie.
- - (true, false) remove_headers_end_handler(handlerID = nil)
  Remove a headers end handler.
- - (::Vertx::HttpServerRequest) request
  The HTTP request object.
- - (void) reroute(param_1 = nil, param_2 = nil)
  Restarts the current router with a new method and path.
- - (::Vertx::HttpServerResponse) response
  The HTTP response object.
- - (::VertxWeb::Session) session
  Get the session.
- - (void) set_acceptable_content_type(contentType = nil)
  Set the acceptable content type.
- - (void) set_body(body = nil)
  Set the body.
- - (void) set_session(session = nil)
  Set the session.
- - (void) set_user(user = nil)
  Set the user.
- - (Fixnum) status_code
  If the context is being routed to failure handlers after a failure has been triggered by calling #fail then this will return that status code.
- - (::VertxAuthCommon::User) user
  Get the authenticated user (if any).
- - (::Vertx::Vertx) vertx
  The Vert.x instance associated to the initiating Router for this context.

## Class Method Details

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

Returns:

- (`Boolean`)

    42
    43
    44
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 42

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

### + (`Object`) j_api_type

    51
    52
    53
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 51

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    54
    55
    56
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 54

    def self.j_class
      Java::IoVertxExtWeb::RoutingContext.java_class
    end

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

    48
    49
    50
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 48

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

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

    45
    46
    47
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 45

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

## Instance Method Details

### - (`Array<::VertxWeb::LanguageHeader>`) acceptable_languages

Returns the languages for the current request. The languages are determined from the `Accept-Language` header and sorted on quality. When 2 or more entries have the same quality then the order used to return the best match is based on the lowest index on the original list. For example if a user has en-US and en-GB with same quality and this order the best match will be en-US because it was declared as first entry by the client.

Returns:

- (`Array<::VertxWeb::LanguageHeader>`) —
  The best matched language for the request

Raises:

- (`ArgumentError`)

    468
    469
    470
    471
    472
    473
    474
    475
    476
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 468

    def acceptable_languages
      if !block_given?
        if @cached_acceptable_languages != nil
          return @cached_acceptable_languages
        end
        return @cached_acceptable_languages = @j_del.java_method(:acceptableLanguages, []).call().to_a.map { |elt| ::Vertx::Util::Utils.safe_create(elt,::VertxWeb::LanguageHeader) }
      end
      raise ArgumentError, "Invalid arguments when calling acceptable_languages()"
    end

### - (`Array<::VertxWeb::Locale>`) acceptable_locales

Returns the locales for the current request. The locales are determined from the `accept-languages` header and sorted on quality. When 2 or more entries have the same quality then the order used to return the best match is based on the lowest index on the original list. For example if a user has en-US and en-GB with same quality and this order the best match will be en-US because it was declared as first entry by the client.

Returns:

- (`Array<::VertxWeb::Locale>`) —
  the best matched locale for the request

Raises:

- (`ArgumentError`)

    452
    453
    454
    455
    456
    457
    458
    459
    460
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 452

    def acceptable_locales
      if !block_given?
        if @cached_acceptable_locales != nil
          return @cached_acceptable_locales
        end
        return @cached_acceptable_locales = @j_del.java_method(:acceptableLocales, []).call().to_a.map { |elt| ::Vertx::Util::Utils.safe_create(elt,::VertxWeb::Locale) }
      end
      raise ArgumentError, "Invalid arguments when calling acceptable_locales()"
    end

### - (`Fixnum`) add_body_end_handler { ... }

Provides a handler that will be called after the last part of the body is written to the wire. The handler is called asynchronously of when the response has been received by the client. This provides a hook allowing you to do more operations once the request has been sent over the wire such as resource cleanup.

Yields:

- the handler

Returns:

- (`Fixnum`) —
  the id of the handler. This can be used if you later want to remove the handler.

Raises:

- (`ArgumentError`)

    362
    363
    364
    365
    366
    367
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 362

    def add_body_end_handler
      if block_given?
        return @j_del.java_method(:addBodyEndHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
      end
      raise ArgumentError, "Invalid arguments when calling add_body_end_handler()"
    end

### - (`self`) add_cookie(cookie = nil)

Add a cookie. This will be sent back to the client in the response. The context must have first been routed to a CookieHandler for this to work.

Parameters:

- cookie (`::VertxWeb::Cookie`) (defaults to: `nil`) —
  the cookie

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    192
    193
    194
    195
    196
    197
    198
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 192

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

### - (`Fixnum`) add_headers_end_handler { ... }

Add a handler that will be called just before headers are written to the response. This gives you a hook where you can write any extra headers before the response has been written when it will be too late.

Yields:

- the handler

Returns:

- (`Fixnum`) —
  the id of the handler. This can be used if you later want to remove the handler.

Raises:

- (`ArgumentError`)

    341
    342
    343
    344
    345
    346
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 341

    def add_headers_end_handler
      if block_given?
        return @j_del.java_method(:addHeadersEndHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
      end
      raise ArgumentError, "Invalid arguments when calling add_headers_end_handler()"
    end

### - (`void`) clear_user

This method returns an undefined value.

Clear the current user object in the context. This usually is used for implementing a log out feature, since the current user is unbounded from the routing context.

Raises:

- (`ArgumentError`)

    414
    415
    416
    417
    418
    419
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 414

    def clear_user
      if !block_given?
        return @j_del.java_method(:clearUser, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling clear_user()"
    end

### - (`Fixnum`) cookie_count

Returns the number of cookies. The context must have first been routed to a CookieHandler for this to work.

Returns:

- (`Fixnum`) —
  the number of cookies. The context must have first been routed to a CookieHandler for this to work.

Raises:

- (`ArgumentError`)

    210
    211
    212
    213
    214
    215
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 210

    def cookie_count
      if !block_given?
        return @j_del.java_method(:cookieCount, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling cookie_count()"
    end

### - (`Set<::VertxWeb::Cookie>`) cookies

Returns a set of all the cookies. The context must have first been routed to a CookieHandler for this to be populated.

Returns:

- (`Set<::VertxWeb::Cookie>`) —
  a set of all the cookies. The context must have first been routed to a CookieHandler for this to be populated.

Raises:

- (`ArgumentError`)

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

    def cookies
      if !block_given?
        return ::Vertx::Util::Utils.to_set(@j_del.java_method(:cookies, []).call()).map! { |elt| ::Vertx::Util::Utils.safe_create(elt,::VertxWeb::Cookie) }
      end
      raise ArgumentError, "Invalid arguments when calling cookies()"
    end

### - (`::VertxWeb::Route`) current_route

Returns the current route this context is being routed through.

Returns:

- (`::VertxWeb::Route`) —
  the current route this context is being routed through.

Raises:

- (`ArgumentError`)

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

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

### - (`void`) fail(statusCode) - (`void`) fail(throwable)

This method returns an undefined value.

Fail the context with the specified throwable.

This will cause the router to route the context to any matching failure handlers for the request. If no failure handlers match a default failure response with status code 500 will be sent.

Overloads:

- - (`void`) fail(statusCode)

  Parameters:

  - statusCode (`Fixnum`) —
    the HTTP status code
- - (`void`) fail(throwable)

  Parameters:

  - throwable (`Exception`) —
    a throwable representing the failure

Raises:

- (`ArgumentError`)

    99
    100
    101
    102
    103
    104
    105
    106
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 99

    def fail(param_1=nil)
      if param_1.class == Fixnum && !block_given?
        return @j_del.java_method(:fail, [Java::int.java_class]).call(param_1)
      elsif param_1.is_a?(Exception) && !block_given?
        return @j_del.java_method(:fail, [Java::JavaLang::Throwable.java_class]).call(::Vertx::Util::Utils.to_throwable(param_1))
      end
      raise ArgumentError, "Invalid arguments when calling fail(#{param_1})"
    end

### - (`true`, `false`) failed

Returns true if the context is being routed to failure handlers.

Returns:

- (`true`, `false`) —
  true if the context is being routed to failure handlers.

Raises:

- (`ArgumentError`)

    378
    379
    380
    381
    382
    383
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 378

    def failed
      if !block_given?
        return @j_del.java_method(:failed, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling failed()"
    end

### - (`Exception`) failure

If the context is being routed to failure handlers after a failure has been triggered by calling #fail then this will return that throwable. It can be used by failure handlers to render a response, e.g. create a failure response page.

Returns:

- (`Exception`) —
  the throwable used when signalling failure

Raises:

- (`ArgumentError`)

    285
    286
    287
    288
    289
    290
    291
    292
    293
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 285

    def failure
      if !block_given?
        if @cached_failure != nil
          return @cached_failure
        end
        return @cached_failure = ::Vertx::Util::Utils.from_throwable(@j_del.java_method(:failure, []).call())
      end
      raise ArgumentError, "Invalid arguments when calling failure()"
    end

### - (`Set<::VertxWeb::FileUpload>`) file_uploads

Returns a set of fileuploads (if any) for the request. The context must have first been routed to a BodyHandler for this to work.

Returns:

- (`Set<::VertxWeb::FileUpload>`) —
  a set of fileuploads (if any) for the request. The context must have first been routed to a BodyHandler for this to work.

Raises:

- (`ArgumentError`)

    257
    258
    259
    260
    261
    262
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 257

    def file_uploads
      if !block_given?
        return ::Vertx::Util::Utils.to_set(@j_del.java_method(:fileUploads, []).call()).map! { |elt| ::Vertx::Util::Utils.safe_create(elt,::VertxWeb::FileUpload) }
      end
      raise ArgumentError, "Invalid arguments when calling file_uploads()"
    end

### - (`Object`) get(key = nil)

Get some data from the context. The data is available in any handlers that receive the context.

Parameters:

- key (`String`) (defaults to: `nil`) —
  the key for the data

Returns:

- (`Object`) —
  the data

Raises:

- (`ArgumentError`)

    121
    122
    123
    124
    125
    126
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 121

    def get(key=nil)
      if key.class == String && !block_given?
        return ::Vertx::Util::Utils.from_object(@j_del.java_method(:get, [Java::java.lang.String.java_class]).call(key))
      end
      raise ArgumentError, "Invalid arguments when calling get(#{key})"
    end

### - (`String`) get_acceptable_content_type

If the route specifies produces matches, e.g. produces `text/html` and `text/plain`, and the `accept` header matches one or more of these then this returns the most acceptable match.

Returns:

- (`String`) —
  the most acceptable content type.

Raises:

- (`ArgumentError`)

    312
    313
    314
    315
    316
    317
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 312

    def get_acceptable_content_type
      if !block_given?
        return @j_del.java_method(:getAcceptableContentType, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling get_acceptable_content_type()"
    end

### - (`::Vertx::Buffer`) get_body

Returns Get the entire HTTP request body as a . The context must have first been routed to a BodyHandler for this to be populated.

Returns:

- (`::Vertx::Buffer`) —
  Get the entire HTTP request body as a . The context must have first been routed to a BodyHandler for this to be populated.

Raises:

- (`ArgumentError`)

    250
    251
    252
    253
    254
    255
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 250

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

### - (`Hash{String => Object}`) get_body_as_json

Returns Get the entire HTTP request body as a . The context must have first been routed to a BodyHandler for this to be populated.

Returns:

- (`Hash{String => Object}`) —
  Get the entire HTTP request body as a . The context must have first been routed to a BodyHandler for this to be populated.

Raises:

- (`ArgumentError`)

    236
    237
    238
    239
    240
    241
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 236

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

### - (`Array<String,Object>`) get_body_as_json_array

Returns Get the entire HTTP request body as a . The context must have first been routed to a BodyHandler for this to be populated.

Returns:

- (`Array<String,Object>`) —
  Get the entire HTTP request body as a . The context must have first been routed to a BodyHandler for this to be populated.

Raises:

- (`ArgumentError`)

    243
    244
    245
    246
    247
    248
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 243

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

### - (`String`) get_body_as_string(encoding = nil)

Get the entire HTTP request body as a string, assuming the specified encoding. The context must have first been routed to a BodyHandler for this to be populated.

Parameters:

- encoding (`String`) (defaults to: `nil`) —
  the encoding, e.g. "UTF-16"

Returns:

- (`String`) —
  the body

Raises:

- (`ArgumentError`)

    227
    228
    229
    230
    231
    232
    233
    234
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 227

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

### - (`::VertxWeb::Cookie`) get_cookie(name = nil)

Get the cookie with the specified name. The context must have first been routed to a CookieHandler for this to work.

Parameters:

- name (`String`) (defaults to: `nil`) —
  the cookie name

Returns:

- (`::VertxWeb::Cookie`) —
  the cookie

Raises:

- (`ArgumentError`)

    182
    183
    184
    185
    186
    187
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 182

    def get_cookie(name=nil)
      if name.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:getCookie, [Java::java.lang.String.java_class]).call(name),::VertxWeb::Cookie)
      end
      raise ArgumentError, "Invalid arguments when calling get_cookie(#{name})"
    end

### - (`String`) mount_point

Returns the mount point for this router. It will be null for a top level router. For a sub-router it will be the path at which the subrouter was mounted.

Returns:

- (`String`) —
  the mount point for this router. It will be null for a top level router. For a sub-router it will be the path at which the subrouter was mounted.

Raises:

- (`ArgumentError`)

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

    def mount_point
      if !block_given?
        return @j_del.java_method(:mountPoint, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling mount_point()"
    end

### - (`void`) next

This method returns an undefined value.

Tell the router to route this context to the next matching route (if any). This method, if called, does not need to be called during the execution of the handler, it can be called some arbitrary time later, if required.

If next is not called for a handler then the handler should make sure it ends the response or no response will be sent.

Raises:

- (`ArgumentError`)

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

    def next
      if !block_given?
        return @j_del.java_method(:next, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling next()"
    end

### - (`String`) normalised_path

Return the normalised path for the request.

The normalised path is where the URI path has been decoded, i.e. any unicode or other illegal URL characters that were encoded in the original URL with `%` will be returned to their original form. E.g. `%20` will revert to a space. Also `+` reverts to a space in a query.

The normalised path will also not contain any `..` character sequences to prevent resources being accessed outside of the permitted area.

It's recommended to always use the normalised path as opposed to if accessing server resources requested by a client.

Returns:

- (`String`) —
  the normalised path

Raises:

- (`ArgumentError`)

    172
    173
    174
    175
    176
    177
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 172

    def normalised_path
      if !block_given?
        return @j_del.java_method(:normalisedPath, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling normalised_path()"
    end

### - (`::VertxWeb::ParsedHeaderValues`) parsed_headers

The headers:

1. Accept
2. Accept-Charset
3. Accept-Encoding
4. Accept-Language
5. Content-Type

Parsed into ParsedHeaderValue

Returns:

- (`::VertxWeb::ParsedHeaderValues`) —
  A container with the parsed headers.

Raises:

- (`ArgumentError`)

    328
    329
    330
    331
    332
    333
    334
    335
    336
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 328

    def parsed_headers
      if !block_given?
        if @cached_parsed_headers != nil
          return @cached_parsed_headers
        end
        return @cached_parsed_headers = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:parsedHeaders, []).call(),::VertxWeb::ParsedHeaderValues)
      end
      raise ArgumentError, "Invalid arguments when calling parsed_headers()"
    end

### - (`String`) path_param(name = nil)

Gets the value of a single path parameter

Parameters:

- name (`String`) (defaults to: `nil`) —
  the name of parameter as defined in path declaration

Returns:

- (`String`) —
  the actual value of the parameter or null if it doesn't exist

Raises:

- (`ArgumentError`)

    512
    513
    514
    515
    516
    517
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 512

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

### - (`Hash{String => String}`) path_params

Returns a map of named parameters as defined in path declaration with their actual values

Returns:

- (`Hash{String => String}`) —
  the map of named parameters

Raises:

- (`ArgumentError`)

    503
    504
    505
    506
    507
    508
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 503

    def path_params
      if !block_given?
        return Java::IoVertxLangRuby::Helper.adaptingMap(@j_del.java_method(:pathParams, []).call(), Proc.new { |val| ::Vertx::Util::Utils.from_object(val) }, Proc.new { |val| ::Vertx::Util::Utils.to_string(val) })
      end
      raise ArgumentError, "Invalid arguments when calling path_params()"
    end

### - (`::VertxWeb::LanguageHeader`) preferred_language

Helper to return the user preferred language. It is the same action as returning the first element of the acceptable languages.

Returns:

- (`::VertxWeb::LanguageHeader`) —
  the users preferred locale.

Raises:

- (`ArgumentError`)

    492
    493
    494
    495
    496
    497
    498
    499
    500
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 492

    def preferred_language
      if !block_given?
        if @cached_preferred_language != nil
          return @cached_preferred_language
        end
        return @cached_preferred_language = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:preferredLanguage, []).call(),::VertxWeb::LanguageHeader)
      end
      raise ArgumentError, "Invalid arguments when calling preferred_language()"
    end

### - (`::VertxWeb::Locale`) preferred_locale

Helper to return the user preferred locale. It is the same action as returning the first element of the acceptable locales.

Returns:

- (`::VertxWeb::Locale`) —
  the users preferred locale.

Raises:

- (`ArgumentError`)

    480
    481
    482
    483
    484
    485
    486
    487
    488
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 480

    def preferred_locale
      if !block_given?
        if @cached_preferred_locale != nil
          return @cached_preferred_locale
        end
        return @cached_preferred_locale = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:preferredLocale, []).call(),::VertxWeb::Locale)
      end
      raise ArgumentError, "Invalid arguments when calling preferred_locale()"
    end

### - (`self`) put(key = nil, obj = nil)

Put some arbitrary data in the context. This will be available in any handlers that receive the context.

Parameters:

- key (`String`) (defaults to: `nil`) —
  the key for the data
- obj (`Object`) (defaults to: `nil`) —
  the data

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    111
    112
    113
    114
    115
    116
    117
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 111

    def put(key=nil,obj=nil)
      if key.class == String && ::Vertx::Util::unknown_type.accept?(obj) && !block_given?
        @j_del.java_method(:put, [Java::java.lang.String.java_class,Java::java.lang.Object.java_class]).call(key,::Vertx::Util::Utils.to_object(obj))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling put(#{key},#{obj})"
    end

### - (`Object`) remove(key = nil)

Remove some data from the context. The data is available in any handlers that receive the context.

Parameters:

- key (`String`) (defaults to: `nil`) —
  the key for the data

Returns:

- (`Object`) —
  the previous data associated with the key

Raises:

- (`ArgumentError`)

    130
    131
    132
    133
    134
    135
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 130

    def remove(key=nil)
      if key.class == String && !block_given?
        return ::Vertx::Util::Utils.from_object(@j_del.java_method(:remove, [Java::java.lang.String.java_class]).call(key))
      end
      raise ArgumentError, "Invalid arguments when calling remove(#{key})"
    end

### - (`true`, `false`) remove_body_end_handler(handlerID = nil)

Remove a body end handler

Parameters:

- handlerID (`Fixnum`) (defaults to: `nil`) —
  the id as returned from #add_body_end_handler.

Returns:

- (`true`, `false`) —
  true if the handler existed and was removed, false otherwise

Raises:

- (`ArgumentError`)

    371
    372
    373
    374
    375
    376
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 371

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

### - (`::VertxWeb::Cookie`) remove_cookie(name = nil)

Remove a cookie. The context must have first been routed to a CookieHandler for this to work.

Parameters:

- name (`String`) (defaults to: `nil`) —
  the name of the cookie

Returns:

- (`::VertxWeb::Cookie`) —
  the cookie, if it existed, or null

Raises:

- (`ArgumentError`)

    203
    204
    205
    206
    207
    208
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 203

    def remove_cookie(name=nil)
      if name.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:removeCookie, [Java::java.lang.String.java_class]).call(name),::VertxWeb::Cookie)
      end
      raise ArgumentError, "Invalid arguments when calling remove_cookie(#{name})"
    end

### - (`true`, `false`) remove_headers_end_handler(handlerID = nil)

Remove a headers end handler

Parameters:

- handlerID (`Fixnum`) (defaults to: `nil`) —
  the id as returned from #add_headers_end_handler.

Returns:

- (`true`, `false`) —
  true if the handler existed and was removed, false otherwise

Raises:

- (`ArgumentError`)

    350
    351
    352
    353
    354
    355
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 350

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

### - (`::Vertx::HttpServerRequest`) request

Returns the HTTP request object

Returns:

- (`::Vertx::HttpServerRequest`) —
  the HTTP request object

Raises:

- (`ArgumentError`)

    58
    59
    60
    61
    62
    63
    64
    65
    66
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 58

    def request
      if !block_given?
        if @cached_request != nil
          return @cached_request
        end
        return @cached_request = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:request, []).call(),::Vertx::HttpServerRequest)
      end
      raise ArgumentError, "Invalid arguments when calling request()"
    end

### - (`void`) reroute(path) - (`void`) reroute(method, path)

This method returns an undefined value.

Restarts the current router with a new method and path. All path parameters are then parsed and available on the params list.

Overloads:

- - (`void`) reroute(path)

  Parameters:

  - path (`String`) —
    the new http path.
- - (`void`) reroute(method, path)

  Parameters:

  - method (`:OPTIONS`, `:GET`, `:HEAD`, `:POST`, `:PUT`, `:DELETE`, `:TRACE`, `:CONNECT`, `:PATCH`, `:OTHER`) —
    the new http request
  - path (`String`) —
    the new http path.

Raises:

- (`ArgumentError`)

    437
    438
    439
    440
    441
    442
    443
    444
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 437

    def reroute(param_1=nil,param_2=nil)
      if param_1.class == String && !block_given? && param_2 == nil
        return @j_del.java_method(:reroute, [Java::java.lang.String.java_class]).call(param_1)
      elsif param_1.class == Symbol && param_2.class == String && !block_given?
        return @j_del.java_method(:reroute, [Java::IoVertxCoreHttp::HttpMethod.java_class,Java::java.lang.String.java_class]).call(Java::IoVertxCoreHttp::HttpMethod.valueOf(param_1.to_s),param_2)
      end
      raise ArgumentError, "Invalid arguments when calling reroute(#{param_1},#{param_2})"
    end

### - (`::Vertx::HttpServerResponse`) response

Returns the HTTP response object

Returns:

- (`::Vertx::HttpServerResponse`) —
  the HTTP response object

Raises:

- (`ArgumentError`)

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

    def response
      if !block_given?
        if @cached_response != nil
          return @cached_response
        end
        return @cached_response = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:response, []).call(),::Vertx::HttpServerResponse)
      end
      raise ArgumentError, "Invalid arguments when calling response()"
    end

### - (`::VertxWeb::Session`) session

Get the session. The context must have first been routed to a SessionHandler for this to be populated. Sessions live for a browser session, and are maintained by session cookies.

Returns:

- (`::VertxWeb::Session`) —
  the session.

Raises:

- (`ArgumentError`)

    267
    268
    269
    270
    271
    272
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 267

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

### - (`void`) set_acceptable_content_type(contentType = nil)

This method returns an undefined value.

Set the acceptable content type. Used by

Parameters:

- contentType (`String`) (defaults to: `nil`) —
  the content type

Raises:

- (`ArgumentError`)

    423
    424
    425
    426
    427
    428
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 423

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

### - (`void`) set_body(body = nil)

This method returns an undefined value.

Set the body. Used by the BodyHandler. You will not normally call this method.

Parameters:

- body (`::Vertx::Buffer`) (defaults to: `nil`) —
  the body

Raises:

- (`ArgumentError`)

    387
    388
    389
    390
    391
    392
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 387

    def set_body(body=nil)
      if body.class.method_defined?(:j_del) && !block_given?
        return @j_del.java_method(:setBody, [Java::IoVertxCoreBuffer::Buffer.java_class]).call(body.j_del)
      end
      raise ArgumentError, "Invalid arguments when calling set_body(#{body})"
    end

### - (`void`) set_session(session = nil)

This method returns an undefined value.

Set the session. Used by the SessionHandler. You will not normally call this method.

Parameters:

- session (`::VertxWeb::Session`) (defaults to: `nil`) —
  the session

Raises:

- (`ArgumentError`)

    396
    397
    398
    399
    400
    401
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 396

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

### - (`void`) set_user(user = nil)

This method returns an undefined value.

Set the user. Usually used by auth handlers to inject a User. You will not normally call this method.

Parameters:

- user (`::VertxAuthCommon::User`) (defaults to: `nil`) —
  the user

Raises:

- (`ArgumentError`)

    405
    406
    407
    408
    409
    410
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 405

    def set_user(user=nil)
      if user.class.method_defined?(:j_del) && !block_given?
        return @j_del.java_method(:setUser, [Java::IoVertxExtAuth::User.java_class]).call(user.j_del)
      end
      raise ArgumentError, "Invalid arguments when calling set_user(#{user})"
    end

### - (`Fixnum`) status_code

If the context is being routed to failure handlers after a failure has been triggered by calling #fail then this will return that status code. It can be used by failure handlers to render a response, e.g. create a failure response page. When the status code has not been set yet (it is undefined) its value will be -1.

Returns:

- (`Fixnum`) —
  the status code used when signalling failure

Raises:

- (`ArgumentError`)

    300
    301
    302
    303
    304
    305
    306
    307
    308
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 300

    def status_code
      if !block_given?
        if @cached_status_code != nil
          return @cached_status_code
        end
        return @cached_status_code = @j_del.java_method(:statusCode, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling status_code()"
    end

### - (`::VertxAuthCommon::User`) user

Get the authenticated user (if any). This will usually be injected by an auth handler if authentication if successful.

Returns:

- (`::VertxAuthCommon::User`) —
  the user, or null if the current user is not authenticated.

Raises:

- (`ArgumentError`)

    275
    276
    277
    278
    279
    280
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 275

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

### - (`::Vertx::Vertx`) vertx

Returns the Vert.x instance associated to the initiating VertxWeb::Router for this context

Returns:

- (`::Vertx::Vertx`) —
  the Vert.x instance associated to the initiating VertxWeb::Router for this context

Raises:

- (`ArgumentError`)

    137
    138
    139
    140
    141
    142
    143
    144
    145
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/routing_context.rb', line 137

    def vertx
      if !block_given?
        if @cached_vertx != nil
          return @cached_vertx
        end
        return @cached_vertx = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:vertx, []).call(),::Vertx::Vertx)
      end
      raise ArgumentError, "Invalid arguments when calling vertx()"
    end