Class List Method List File List

# Class: VertxWeb::Cookie

Inherits:
  Vertx::Cookie
  - Object
  - Vertx::Cookie
  - VertxWeb::Cookie
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb

## Overview

Represents an HTTP Cookie.

All cookies must have a name and a value and can optionally have other fields set such as path, domain, etc.

(Derived from io.netty.handler.codec.http.Cookie)

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (::VertxWeb::Cookie) cookie(name = nil, value = nil)
  Create a new cookie.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (true, false) changed?
  Has the cookie been changed? Changed cookieMap will be saved out in the response and sent to the browser.
- - (String) encode
  Encode the cookie to a string.
- - (true, false) from_user_agent?
  Has this Cookie been sent from the User Agent (the browser)? or was created during the executing on the request.
- - (String) get_domain
  The domain for the cookie.
- - (String) get_name
  The name of this cookie.
- - (String) get_path
  The path for this cookie.
- - (:NONE, ...) get_same_site
  The SameSite policy of this cookie.
- - (String) get_value
  The value of this cookie.
- - (true, false) http_only?
  The http only status of this cookie.
- - (true, false) secure?
  The security status of this cookie.
- - (void) set_changed(changed = nil)
  Set the cookie as being changed.
- - (self) set_domain(domain = nil)
- - (self) set_http_only(httpOnly = nil)
- - (self) set_max_age(maxAge = nil)
- - (self) set_path(path = nil)
- - (self) set_same_site(policy = nil)
  Sets the same site of this cookie.
- - (self) set_secure(secure = nil)
- - (self) set_value(value = nil)

## Class Method Details

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

Returns:

- (`Boolean`)

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

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

### + (`::VertxWeb::Cookie`) cookie(name = nil, value = nil)

Create a new cookie

Parameters:

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

Returns:

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

Raises:

- (`ArgumentError`)

    109
    110
    111
    112
    113
    114
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 109

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

### + (`Object`) j_api_type

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

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

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

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

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

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

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

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

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

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

## Instance Method Details

### - (`true`, `false`) changed?

Has the cookie been changed? Changed cookieMap will be saved out in the response and sent to the browser.

Returns:

- (`true`, `false`) —
  true if changed

Raises:

- (`ArgumentError`)

    171
    172
    173
    174
    175
    176
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 171

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

### - (`String`) encode

Encode the cookie to a string. This is what is used in the Set-Cookie header

Returns:

- (`String`) —
  the encoded cookie

Raises:

- (`ArgumentError`)

    99
    100
    101
    102
    103
    104
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 99

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

### - (`true`, `false`) from_user_agent?

Has this Cookie been sent from the User Agent (the browser)? or was created during the executing on the request.

Returns:

- (`true`, `false`) —
  true if the cookie comes from the User Agent.

Raises:

- (`ArgumentError`)

    189
    190
    191
    192
    193
    194
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 189

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

### - (`String`) get_domain

Returns the domain for the cookie

Returns:

- (`String`) —
  the domain for the cookie

Raises:

- (`ArgumentError`)

    53
    54
    55
    56
    57
    58
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 53

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

### - (`String`) get_name

Returns the name of this cookie

Returns:

- (`String`) —
  the name of this cookie

Raises:

- (`ArgumentError`)

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

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

### - (`String`) get_path

Returns the path for this cookie

Returns:

- (`String`) —
  the path for this cookie

Raises:

- (`ArgumentError`)

    60
    61
    62
    63
    64
    65
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 60

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

### - (`:NONE`, ...) get_same_site

Returns the SameSite policy of this cookie

Returns:

- (`:NONE`, `:STRICT`, `:LAX`) —
  the SameSite policy of this cookie

Raises:

- (`ArgumentError`)

    91
    92
    93
    94
    95
    96
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 91

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

### - (`String`) get_value

Returns the value of this cookie

Returns:

- (`String`) —
  the value of this cookie

Raises:

- (`ArgumentError`)

    46
    47
    48
    49
    50
    51
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 46

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

### - (`true`, `false`) http_only?

Returns the http only status of this cookie

Returns:

- (`true`, `false`) —
  the http only status of this cookie

Raises:

- (`ArgumentError`)

    74
    75
    76
    77
    78
    79
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 74

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

### - (`true`, `false`) secure?

Returns the security status of this cookie

Returns:

- (`true`, `false`) —
  the security status of this cookie

Raises:

- (`ArgumentError`)

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

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

### - (`void`) set_changed(changed = nil)

This method returns an undefined value.

Set the cookie as being changed. Changed will be true for a cookie just created, false by default if just read from the request

Parameters:

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

Raises:

- (`ArgumentError`)

    181
    182
    183
    184
    185
    186
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 181

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

### - (`self`) set_domain(domain = nil)

Parameters:

- domain (`String`) (defaults to: `nil`)

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    126
    127
    128
    129
    130
    131
    132
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 126

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

### - (`self`) set_http_only(httpOnly = nil)

Parameters:

- httpOnly (`true`, `false`) (defaults to: `nil`)

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    162
    163
    164
    165
    166
    167
    168
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 162

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

### - (`self`) set_max_age(maxAge = nil)

Parameters:

- maxAge (`Fixnum`) (defaults to: `nil`)

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    144
    145
    146
    147
    148
    149
    150
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 144

    def set_max_age(maxAge=nil)
      if maxAge.class == Fixnum && !block_given?
        @j_del.java_method(:setMaxAge, [Java::long.java_class]).call(maxAge)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_max_age(#{maxAge})"
    end

### - (`self`) set_path(path = nil)

Parameters:

- path (`String`) (defaults to: `nil`)

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    135
    136
    137
    138
    139
    140
    141
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 135

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

### - (`self`) set_same_site(policy = nil)

Sets the same site of this cookie.

Parameters:

- policy (`:NONE`, `:STRICT`, `:LAX`) (defaults to: `nil`) —
  The policy should be one of .

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    83
    84
    85
    86
    87
    88
    89
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 83

    def set_same_site(policy=nil)
      if policy.class == Symbol && !block_given?
        @j_del.java_method(:setSameSite, [Java::IoVertxCoreHttp::CookieSameSite.java_class]).call(Java::IoVertxCoreHttp::CookieSameSite.valueOf(policy.to_s))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_same_site(#{policy})"
    end

### - (`self`) set_secure(secure = nil)

Parameters:

- secure (`true`, `false`) (defaults to: `nil`)

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    153
    154
    155
    156
    157
    158
    159
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 153

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

### - (`self`) set_value(value = nil)

Parameters:

- value (`String`) (defaults to: `nil`)

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    117
    118
    119
    120
    121
    122
    123
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 117

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