Class: VertxWeb::Session
- Inherits:
-
Object
- Object
- VertxWeb::Session
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/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.
Instance Method Summary (collapse)
-
- (void) destroy
Destroy the session.
-
- (true, false) destroyed?
@return has the session been destroyed?.
-
- (Object) get(key = nil)
Get some data from the session.
-
- (String) id
@return The unique ID of the session.
-
- (Fixnum) last_accessed
@return the time the session was last accessed.
-
- (self) put(key = nil, obj = nil)
Put some data in a session.
-
- (Object) remove(key = nil)
Remove some data from the session.
-
- (void) set_accessed
Mark the session as being accessed.
-
- (Fixnum) timeout
@return the amount of time in ms, after which the session will expire, if not accessed.
Instance Method Details
- (void) destroy
This method returns an undefined value.
Destroy the session
71 72 73 74 75 76 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/session.rb', line 71 def destroy if !block_given? return @j_del.java_method(:destroy, []).call() end raise ArgumentError, "Invalid arguments when calling destroy()" end |
- (true, false) destroyed?
@return has the session been destroyed?
79 80 81 82 83 84 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/session.rb', line 79 def destroyed? if !block_given? return @j_del.java_method(:isDestroyed, []).call() end raise ArgumentError, "Invalid arguments when calling destroyed?()" end |
- (Object) get(key = nil)
Get some data from the session
46 47 48 49 50 51 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/session.rb', line 46 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
@return The unique ID of the session. This is generated using a random secure UUID.
26 27 28 29 30 31 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/session.rb', line 26 def id if !block_given? return @j_del.java_method(:id, []).call() end raise ArgumentError, "Invalid arguments when calling id()" end |
- (Fixnum) last_accessed
@return the time the session was last accessed
63 64 65 66 67 68 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/session.rb', line 63 def last_accessed if !block_given? return @j_del.java_method(:lastAccessed, []).call() end raise ArgumentError, "Invalid arguments when calling last_accessed()" end |
- (self) put(key = nil, obj = nil)
Put some data in a session
36 37 38 39 40 41 42 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/session.rb', line 36 def put(key=nil,obj=nil) if key.class == String && (obj.class == String || obj.class == Hash || obj.class == Array || obj.class == NilClass || obj.class == TrueClass || obj.class == FalseClass || obj.class == Fixnum || obj.class == Float) && !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 |
- (Object) remove(key = nil)
Remove some data from the session
55 56 57 58 59 60 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/session.rb', line 55 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.
95 96 97 98 99 100 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/session.rb', line 95 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
@return the amount of time in ms, after which the session will expire, if not accessed.
87 88 89 90 91 92 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/session.rb', line 87 def timeout if !block_given? return @j_del.java_method(:timeout, []).call() end raise ArgumentError, "Invalid arguments when calling timeout()" end |