Class: VertxWeb::Cookie
- Inherits:
-
Vertx::Cookie
- Object
- Vertx::Cookie
- VertxWeb::Cookie
- 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)
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
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.(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.
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
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.
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
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
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
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
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
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
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
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
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)
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)
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)
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)
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.
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)
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)
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 |