Class: Vertx::Cookie
- Inherits:
-
Object
- Object
- Vertx::Cookie
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/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.
Direct Known Subclasses
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
-
+ (::Vertx::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)
-
- (String) encode
Encode the cookie to a string.
-
- (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.
-
- (self) set_domain(domain = nil)
Sets the domain of this cookie.
-
- (self) set_http_only(httpOnly = nil)
Determines if this cookie is HTTP only.
-
- (self) set_max_age(maxAge = nil)
Sets the maximum age of this cookie in seconds.
-
- (self) set_path(path = nil)
Sets the path of this cookie.
-
- (self) set_same_site(policy = nil)
Sets the same site of this cookie.
-
- (self) set_secure(secure = nil)
Sets the security getStatus of this cookie.
-
- (self) set_value(value = nil)
Sets the value of this cookie.
Class Method Details
+ (Boolean) accept?(obj)
19 20 21 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 19 def @@j_api_type.accept?(obj) obj.class == Cookie end |
+ (::Vertx::Cookie) cookie(name = nil, value = nil)
Create a new cookie
38 39 40 41 42 43 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 38 def self.(name=nil,value=nil) if name.class == String && value.class == String && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxCoreHttp::Cookie.java_method(:cookie, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(name,value),::Vertx::Cookie) end raise ArgumentError, "Invalid arguments when calling cookie(#{name},#{value})" end |
+ (Object) j_api_type
28 29 30 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 28 def self.j_api_type @@j_api_type end |
+ (Object) j_class
31 32 33 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 31 def self.j_class Java::IoVertxCoreHttp::Cookie.java_class end |
+ (Object) unwrap(obj)
25 26 27 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 25 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
22 23 24 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 22 def @@j_api_type.wrap(obj) Cookie.new(obj) end |
Instance Method Details
- (String) encode
Encode the cookie to a string. This is what is used in the Set-Cookie header
174 175 176 177 178 179 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 174 def encode if !block_given? return @j_del.java_method(:encode, []).call() end raise ArgumentError, "Invalid arguments when calling encode()" end |
- (String) get_domain
Returns the domain for the cookie
79 80 81 82 83 84 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 79 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
45 46 47 48 49 50 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 45 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
96 97 98 99 100 101 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 96 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
166 167 168 169 170 171 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 166 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
52 53 54 55 56 57 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 52 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
149 150 151 152 153 154 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 149 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
128 129 130 131 132 133 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 128 def secure? if !block_given? return @j_del.java_method(:isSecure, []).call() end raise ArgumentError, "Invalid arguments when calling secure?()" end |
- (self) set_domain(domain = nil)
Sets the domain of this cookie
71 72 73 74 75 76 77 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 71 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)
Determines if this cookie is HTTP only.
If set to true, this cookie cannot be accessed by a client
side script. However, this works only if the browser supports it.
For for information, please look
here.
141 142 143 144 145 146 147 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 141 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)
Sets the maximum age of this cookie in seconds.
If an age of
0
is specified, this cookie will be
automatically removed by browser because it will expire immediately.
If MIN_VALUE is specified, this cookie will be removed when the
browser is closed.
If you don't set this the cookie will be a session cookie and be removed when the browser is closed.
110 111 112 113 114 115 116 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 110 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)
Sets the path of this cookie.
88 89 90 91 92 93 94 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 88 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.
158 159 160 161 162 163 164 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 158 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)
Sets the security getStatus of this cookie
120 121 122 123 124 125 126 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 120 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)
Sets the value of this cookie
61 62 63 64 65 66 67 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/cookie.rb', line 61 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 |