Class: VertxApex::Cookie
- Inherits:
-
Object
- Object
- VertxApex::Cookie
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-apex/src/main/resources/vertx-apex/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)
Class Method Summary (collapse)
-
+ (::VertxApex::Cookie) cookie(name = nil, value = nil)
Create a new cookie.
Instance Method Summary (collapse)
-
- (true, false) changed?
Has the cookie been changed? Changed cookies will be saved out in the response and sent to the browser.
-
- (String) encode
Encode the cookie to a string.
-
- (String) get_domain
@return the domain for the cookie.
-
- (String) get_name
@return the name of this cookie.
-
- (String) get_path
The path for this cookie.
-
- (String) get_value
@return the value of this cookie.
-
- (void) set_changed(changed = nil)
Set the cookie as being changed.
-
- (self) set_domain(domain = nil)
Sets the domain of this cookie.
-
- (::VertxApex::Cookie) set_http_only(httpOnly = nil)
Determines if this cookie is HTTP only.
-
- (::VertxApex::Cookie) 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_secure(secure = nil)
Sets the security getStatus of this cookie.
-
- (self) set_value(value = nil)
Sets the value of this cookie.
-
- (self) set_version(version = nil)
Set the version of the cookie.
Class Method Details
+ (::VertxApex::Cookie) cookie(name = nil, value = nil)
Create a new cookie
24 25 26 27 28 29 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-apex/src/main/resources/vertx-apex/cookie.rb', line 24 def self.(name=nil,value=nil) if name.class == String && value.class == String && !block_given? return ::VertxApex::Cookie.new(Java::IoVertxExtApex::Cookie.java_method(:cookie, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(name,value)) end raise ArgumentError, "Invalid arguments when calling cookie(name,value)" end |
Instance Method Details
- (true, false) changed?
Has the cookie been changed? Changed cookies will be saved out in the response and sent to the browser.
148 149 150 151 152 153 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-apex/src/main/resources/vertx-apex/cookie.rb', line 148 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
140 141 142 143 144 145 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-apex/src/main/resources/vertx-apex/cookie.rb', line 140 def encode if !block_given? return @j_del.java_method(:encode, []).call() end raise ArgumentError, "Invalid arguments when calling encode()" end |
- (String) get_domain
@return the domain for the cookie
68 69 70 71 72 73 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-apex/src/main/resources/vertx-apex/cookie.rb', line 68 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
@return the name of this cookie
32 33 34 35 36 37 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-apex/src/main/resources/vertx-apex/cookie.rb', line 32 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
85 86 87 88 89 90 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-apex/src/main/resources/vertx-apex/cookie.rb', line 85 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
@return the value of this cookie
40 41 42 43 44 45 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-apex/src/main/resources/vertx-apex/cookie.rb', line 40 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
158 159 160 161 162 163 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-apex/src/main/resources/vertx-apex/cookie.rb', line 158 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)
Sets the domain of this cookie
59 60 61 62 63 64 65 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-apex/src/main/resources/vertx-apex/cookie.rb', line 59 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 |
- (::VertxApex::Cookie) 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.
122 123 124 125 126 127 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-apex/src/main/resources/vertx-apex/cookie.rb', line 122 def set_http_only(httpOnly=nil) if (httpOnly.class == TrueClass || httpOnly.class == FalseClass) && !block_given? return ::VertxApex::Cookie.new(@j_del.java_method(:setHttpOnly, [Java::boolean.java_class]).call(httpOnly)) end raise ArgumentError, "Invalid arguments when calling set_http_only(httpOnly)" end |
- (::VertxApex::Cookie) 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 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.
99 100 101 102 103 104 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-apex/src/main/resources/vertx-apex/cookie.rb', line 99 def set_max_age(maxAge=nil) if maxAge.class == Fixnum && !block_given? return ::VertxApex::Cookie.new(@j_del.java_method(:setMaxAge, [Java::long.java_class]).call(maxAge)) end raise ArgumentError, "Invalid arguments when calling set_max_age(maxAge)" end |
- (self) set_path(path = nil)
Sets the path of this cookie.
77 78 79 80 81 82 83 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-apex/src/main/resources/vertx-apex/cookie.rb', line 77 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)
Sets the security getStatus of this cookie
108 109 110 111 112 113 114 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-apex/src/main/resources/vertx-apex/cookie.rb', line 108 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
49 50 51 52 53 54 55 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-apex/src/main/resources/vertx-apex/cookie.rb', line 49 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 |
- (self) set_version(version = nil)
Set the version of the cookie
131 132 133 134 135 136 137 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-apex/src/main/resources/vertx-apex/cookie.rb', line 131 def set_version(version=nil) if version.class == Fixnum && !block_given? @j_del.java_method(:setVersion, [Java::int.java_class]).call(version) return self end raise ArgumentError, "Invalid arguments when calling set_version(version)" end |