Class: VertxWeb::Session
- Inherits:
-
Object
- Object
- VertxWeb::Session
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb
Overview
Represents a browser session.
Sessions persist between HTTP requests for a single browser session. They are deleted when the browser is closed, or they time-out. Session cookies are used to maintain sessions using a secure UUID.
Sessions can be used to maintain data for a browser session, e.g. a shopping basket.
The context must have first been routed to a SessionHandler for sessions to be available.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (void) destroy
Destroy the session.
-
- (true, false) destroyed?
Has the session been destroyed?.
-
- (true, false) empty?
True if the session has data.
-
- (Object) get(key = nil)
Get some data from the session.
-
- (String) id
The unique ID of the session.
-
- (Fixnum) last_accessed
The time the session was last accessed.
-
- (String) old_id
Old ID if renewed.
-
- (self) put(key = nil, obj = nil)
Put some data in a session.
-
- (::VertxWeb::Session) regenerate_id
The new unique ID of the session.
-
- (true, false) regenerated?
Has the session been renewed?.
-
- (Object) remove(key = nil)
Remove some data from the session.
-
- (void) set_accessed
Mark the session as being accessed.
-
- (Fixnum) timeout
The amount of time in ms, after which the session will expire, if not accessed.
-
- (String) value
The short representation of the session to be added to the session cookie.
Class Method Details
+ (Boolean) accept?(obj)
25 26 27 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 25 def @@j_api_type.accept?(obj) obj.class == Session end |
+ (Object) j_api_type
34 35 36 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 34 def self.j_api_type @@j_api_type end |
+ (Object) j_class
37 38 39 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 37 def self.j_class Java::IoVertxExtWeb::Session.java_class end |
+ (Object) unwrap(obj)
31 32 33 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 31 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
28 29 30 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 28 def @@j_api_type.wrap(obj) Session.new(obj) end |
Instance Method Details
- (void) destroy
This method returns an undefined value.
Destroy the session
99 100 101 102 103 104 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 99 def destroy if !block_given? return @j_del.java_method(:destroy, []).call() end raise ArgumentError, "Invalid arguments when calling destroy()" end |
- (true, false) destroyed?
Returns has the session been destroyed?
106 107 108 109 110 111 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 106 def destroyed? if !block_given? return @j_del.java_method(:isDestroyed, []).call() end raise ArgumentError, "Invalid arguments when calling destroyed?()" end |
- (true, false) empty?
Returns true if the session has data
84 85 86 87 88 89 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 84 def empty? if !block_given? return @j_del.java_method(:isEmpty, []).call() end raise ArgumentError, "Invalid arguments when calling empty?()" end |
- (Object) get(key = nil)
Get some data from the session
68 69 70 71 72 73 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 68 def get(key=nil) if key.class == String && !block_given? return ::Vertx::Util::Utils.from_object(@j_del.java_method(:get, [Java::java.lang.String.java_class]).call(key)) end raise ArgumentError, "Invalid arguments when calling get(#{key})" end |
- (String) id
Returns The unique ID of the session. This is generated using a random secure UUID.
48 49 50 51 52 53 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 48 def id if !block_given? return @j_del.java_method(:id, []).call() end raise ArgumentError, "Invalid arguments when calling id()" end |
- (Fixnum) last_accessed
Returns the time the session was last accessed
91 92 93 94 95 96 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 91 def last_accessed if !block_given? return @j_del.java_method(:lastAccessed, []).call() end raise ArgumentError, "Invalid arguments when calling last_accessed()" end |
- (String) old_id
Returns old ID if renewed
120 121 122 123 124 125 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 120 def old_id if !block_given? return @j_del.java_method(:oldId, []).call() end raise ArgumentError, "Invalid arguments when calling old_id()" end |
- (self) put(key = nil, obj = nil)
Put some data in a session
58 59 60 61 62 63 64 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 58 def put(key=nil,obj=nil) if key.class == String && ::Vertx::Util::unknown_type.accept?(obj) && !block_given? @j_del.java_method(:put, [Java::java.lang.String.java_class,Java::java.lang.Object.java_class]).call(key,::Vertx::Util::Utils.to_object(obj)) return self end raise ArgumentError, "Invalid arguments when calling put(#{key},#{obj})" end |
- (::VertxWeb::Session) regenerate_id
Returns The new unique ID of the session.
41 42 43 44 45 46 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 41 def regenerate_id if !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:regenerateId, []).call(),::VertxWeb::Session) end raise ArgumentError, "Invalid arguments when calling regenerate_id()" end |
- (true, false) regenerated?
Returns has the session been renewed?
113 114 115 116 117 118 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 113 def regenerated? if !block_given? return @j_del.java_method(:isRegenerated, []).call() end raise ArgumentError, "Invalid arguments when calling regenerated?()" end |
- (Object) remove(key = nil)
Remove some data from the session
77 78 79 80 81 82 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 77 def remove(key=nil) if key.class == String && !block_given? return ::Vertx::Util::Utils.from_object(@j_del.java_method(:remove, [Java::java.lang.String.java_class]).call(key)) end raise ArgumentError, "Invalid arguments when calling remove(#{key})" end |
- (void) set_accessed
This method returns an undefined value.
Mark the session as being accessed.
135 136 137 138 139 140 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 135 def set_accessed if !block_given? return @j_del.java_method(:setAccessed, []).call() end raise ArgumentError, "Invalid arguments when calling set_accessed()" end |
- (Fixnum) timeout
Returns the amount of time in ms, after which the session will expire, if not accessed.
127 128 129 130 131 132 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 127 def timeout if !block_given? return @j_del.java_method(:timeout, []).call() end raise ArgumentError, "Invalid arguments when calling timeout()" end |
- (String) value
The short representation of the session to be added to the session cookie. By default is the session id.
143 144 145 146 147 148 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/session.rb', line 143 def value if !block_given? return @j_del.java_method(:value, []).call() end raise ArgumentError, "Invalid arguments when calling value()" end |