Class: VertxWeb::Cookie

Inherits:
Vertx::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)

Instance Method Summary (collapse)

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
Create a new cookie

Parameters:

  • name (String) (defaults to: nil)
    the name of the cookie
  • value (String) (defaults to: nil)
    the cookie value

Returns:

Raises:

  • (ArgumentError)

78
79
80
81
82
83
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 78

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)

140
141
142
143
144
145
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 140

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)

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

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)

158
159
160
161
162
163
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 158

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

- (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

- (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)

150
151
152
153
154
155
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 150

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)

95
96
97
98
99
100
101
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 95

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)

131
132
133
134
135
136
137
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 131

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)

113
114
115
116
117
118
119
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 113

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)

104
105
106
107
108
109
110
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 104

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_secure(secure = nil)

Parameters:

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

Returns:

  • (self)

Raises:

  • (ArgumentError)

122
123
124
125
126
127
128
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/cookie.rb', line 122

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)

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

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