public class SessionHelper extends Object
Constructor and Description |
---|
SessionHelper(org.vertx.java.core.Vertx vertx)
Creates a session helper for this Vertx instance.
|
SessionHelper(org.vertx.java.core.Vertx vertx,
String sessionManagerAddress)
Creates a session helper for this Vertx instance.
|
SessionHelper(org.vertx.java.core.Vertx vertx,
String sessionManagerAddress,
String cookieField,
String cookiePath)
Creates a session helper for this Vertx instance with a custom cookie field name.
|
Modifier and Type | Method and Description |
---|---|
void |
checkAllSessionsForMatch(org.vertx.java.core.json.JsonObject json,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
Checks all sessions for a potential match of the specified JsonObject and returns the reply
of the session manager ({ matches : true/false, sessions: [...all matching sessions or empty
JsonArray...] }).
|
void |
destroySession(String sessionId,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
Destroys a session and gives the result to a handler.
|
String |
getSessionId(org.vertx.java.core.http.HttpServerRequest req) |
void |
putSessionData(org.vertx.java.core.http.HttpServerRequest req,
org.vertx.java.core.json.JsonObject obj)
Puts multiple data fields into the session storage without need of the result.
|
void |
putSessionData(org.vertx.java.core.http.HttpServerRequest req,
org.vertx.java.core.json.JsonObject obj,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
Puts multiple data fields into the session storage and retrieves the result of the storage
operation.
|
void |
putSessionData(org.vertx.java.core.http.HttpServerRequest req,
String key,
boolean obj)
Puts a boolean into the session storage without need of the result.
|
void |
putSessionData(org.vertx.java.core.http.HttpServerRequest req,
String key,
boolean obj,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
Puts a boolean into the session storage and retrieves the result of the storage operation.
|
void |
putSessionData(org.vertx.java.core.http.HttpServerRequest req,
String key,
byte[] obj)
Puts a byte array into the session storage without need of the result.
|
void |
putSessionData(org.vertx.java.core.http.HttpServerRequest req,
String key,
byte[] obj,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
Puts a byte array into the session storage and retrieves the result of the storage operation.
|
void |
putSessionData(org.vertx.java.core.http.HttpServerRequest req,
String key,
org.vertx.java.core.json.JsonArray obj)
Puts a JsonArray into the session storage without need of the result.
|
void |
putSessionData(org.vertx.java.core.http.HttpServerRequest req,
String key,
org.vertx.java.core.json.JsonArray obj,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
Puts a JsonArray into the session storage and retrieves the result of the storage operation.
|
void |
putSessionData(org.vertx.java.core.http.HttpServerRequest req,
String key,
org.vertx.java.core.json.JsonObject obj)
Puts a JsonObject into the session storage without need of the result.
|
void |
putSessionData(org.vertx.java.core.http.HttpServerRequest req,
String key,
org.vertx.java.core.json.JsonObject obj,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
Puts a JsonObject into the session storage and retrieves the result of the storage operation.
|
void |
putSessionData(org.vertx.java.core.http.HttpServerRequest req,
String key,
Number obj)
Puts a number into the session storage without need of the result.
|
void |
putSessionData(org.vertx.java.core.http.HttpServerRequest req,
String key,
Number obj,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
Puts a number into the session storage and retrieves the result of the storage operation.
|
void |
putSessionData(org.vertx.java.core.http.HttpServerRequest req,
String key,
String obj)
Puts a String into the session storage without need of the result.
|
void |
putSessionData(org.vertx.java.core.http.HttpServerRequest req,
String key,
String obj,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
Puts a String into the session storage and retrieves the result of the storage operation.
|
void |
putSessionData(String sessionId,
org.vertx.java.core.json.JsonObject obj)
Puts multiple data fields into the session storage without need of the result.
|
void |
putSessionData(String sessionId,
org.vertx.java.core.json.JsonObject obj,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
Puts multiple data fields into the session storage without need of the result.
|
void |
putSessionData(String sessionId,
String key,
boolean obj)
Puts a boolean into the session storage without need of the result.
|
void |
putSessionData(String sessionId,
String key,
boolean obj,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
Puts a boolean into the session storage and retrieves the result of the storage operation.
|
void |
putSessionData(String sessionId,
String key,
byte[] obj)
Puts a byte array into the session storage without need of the result.
|
void |
putSessionData(String sessionId,
String key,
byte[] obj,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
Puts a byte array into the session storage and retrieves the result of the storage operation.
|
void |
putSessionData(String sessionId,
String key,
org.vertx.java.core.json.JsonArray obj)
Puts a JsonArray into the session storage without need of the result.
|
void |
putSessionData(String sessionId,
String key,
org.vertx.java.core.json.JsonArray obj,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
Puts a JsonArray into the session storage and retrieves the result of the storage operation.
|
void |
putSessionData(String sessionId,
String key,
org.vertx.java.core.json.JsonObject obj)
Puts a JsonObject into the session storage without need of the result.
|
void |
putSessionData(String sessionId,
String key,
org.vertx.java.core.json.JsonObject obj,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
Puts a JsonObject into the session storage and retrieves the result of the storage operation.
|
void |
putSessionData(String sessionId,
String key,
Number obj)
Puts a number into the session storage without need of the result.
|
void |
putSessionData(String sessionId,
String key,
Number obj,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
Puts a number into the session storage and retrieves the result of the storage operation.
|
void |
putSessionData(String sessionId,
String key,
String obj)
Puts a String into the session storage without need of the result.
|
void |
putSessionData(String sessionId,
String key,
String obj,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
Puts a String into the session storage and retrieves the result of the storage operation.
|
void |
startSession(org.vertx.java.core.http.HttpServerRequest req,
org.vertx.java.core.Handler<String> handlerWithSessionId)
Creates a new session for the specified request.
|
void |
withConnectionStats(org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> handler)
Gets informations about open sessions and delivers this info to the specified handler.
|
void |
withSessionData(org.vertx.java.core.http.HttpServerRequest req,
org.vertx.java.core.json.JsonArray requiredFields,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> handler)
Gets multiple data fields from the session storage by using an HttpServerRequest.
|
void |
withSessionData(org.vertx.java.core.http.HttpServerRequest req,
String requiredField,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> handler)
Gets a single data field from the session storage by using an HttpServerRequest.
|
void |
withSessionData(String sessionId,
org.vertx.java.core.json.JsonArray requiredFields,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> handler)
Gets multiple data fields from the session storage by using a session id.
|
void |
withSessionData(String sessionId,
String requiredField,
org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> handler)
Gets a single data field from the session storage by using a session id.
|
void |
withSessionId(org.vertx.java.core.http.HttpServerRequest req,
org.vertx.java.core.Handler<String> handler)
Does something with a session id.
|
public SessionHelper(org.vertx.java.core.Vertx vertx)
vertx
- The Vertx instance to use this session helper. The Vertx is used for the
communication over the event bus.public SessionHelper(org.vertx.java.core.Vertx vertx, String sessionManagerAddress)
vertx
- The Vertx instance to use this session helper. The Vertx is used for the
communication over the event bus.sessionManagerAddress
- The address on which the session manager is listening on.public SessionHelper(org.vertx.java.core.Vertx vertx, String sessionManagerAddress, String cookieField, String cookiePath)
vertx
- The Vertx instance to use this session helper. The Vertx is used for the
communication over the event bus.sessionManagerAddress
- The address on which the session manager is listening on.cookieField
- The name of the generated field in the cookie for the client.cookiePath
- the path of the cookiepublic void withSessionData(org.vertx.java.core.http.HttpServerRequest req, String requiredField, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> handler)
req
- The http server request.requiredField
- The wanted field from the session storage.handler
- A handler for the received data.public void withSessionData(org.vertx.java.core.http.HttpServerRequest req, org.vertx.java.core.json.JsonArray requiredFields, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> handler)
req
- The http server request.requiredFields
- The wanted fields from the session storage.handler
- A handler A handler for the received data.public void withSessionData(String sessionId, String requiredField, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> handler)
sessionId
- The id of the session.requiredField
- The wanted field from the session storage.handler
- A handler for the received data.public void withSessionData(String sessionId, org.vertx.java.core.json.JsonArray requiredFields, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> handler)
sessionId
- The id of the session.requiredFields
- The wanted fields from the session storage.handler
- A handler for the received data.public void putSessionData(org.vertx.java.core.http.HttpServerRequest req, org.vertx.java.core.json.JsonObject obj)
req
- The http server request.obj
- A JsonObject which provides key-value pairs.public void putSessionData(org.vertx.java.core.http.HttpServerRequest req, String key, org.vertx.java.core.json.JsonArray obj)
req
- The http server request.key
- The name of the field to put data into.obj
- The JsonArray to store.public void putSessionData(org.vertx.java.core.http.HttpServerRequest req, String key, byte[] obj)
req
- The http server request.key
- The name of the field to put data into.obj
- The byte array to store.public void putSessionData(org.vertx.java.core.http.HttpServerRequest req, String key, boolean obj)
req
- The http server request.key
- The name of the field to put data into.obj
- The boolean to store.public void putSessionData(org.vertx.java.core.http.HttpServerRequest req, String key, Number obj)
req
- The http server request.key
- The name of the field to put data into.obj
- The number to store.public void putSessionData(org.vertx.java.core.http.HttpServerRequest req, String key, org.vertx.java.core.json.JsonObject obj)
req
- The http server request.key
- The name of the field to put data into.obj
- The JsonObject to store.public void putSessionData(org.vertx.java.core.http.HttpServerRequest req, String key, String obj)
req
- The http server request.key
- The name of the field to put data into.obj
- The String to store.public void putSessionData(org.vertx.java.core.http.HttpServerRequest req, org.vertx.java.core.json.JsonObject obj, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
req
- The http server request.obj
- A JsonObject which includes key-value pairs to store.doneHandler
- The handler to call after storing finished. It will receive the message sent by
the session manager.public void putSessionData(org.vertx.java.core.http.HttpServerRequest req, String key, org.vertx.java.core.json.JsonArray obj, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
req
- The http server request.key
- The name of the field to put data into.obj
- The JsonArray to store.doneHandler
- The handler to call after storing finished. It will receive the message sent by
the session manager.public void putSessionData(org.vertx.java.core.http.HttpServerRequest req, String key, byte[] obj, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
req
- The http server request.key
- The name of the field to put data into.obj
- The byte array to store.doneHandler
- The handler to call after storing finished. It will receive the message sent by
the session manager.public void putSessionData(org.vertx.java.core.http.HttpServerRequest req, String key, boolean obj, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
req
- The http server request.key
- The name of the field to put data into.obj
- The boolean to store.doneHandler
- The handler to call after storing finished. It will receive the message sent by
the session manager.public void putSessionData(org.vertx.java.core.http.HttpServerRequest req, String key, Number obj, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
req
- The http server request.key
- The name of the field to put data into.obj
- The number to store.doneHandler
- The handler to call after storing finished. It will receive the message sent by
the session manager.public void putSessionData(org.vertx.java.core.http.HttpServerRequest req, String key, org.vertx.java.core.json.JsonObject obj, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
req
- The http server request.key
- The name of the field to put data into.obj
- The JsonObject to store.doneHandler
- The handler to call after storing finished. It will receive the message sent by
the session manager.public void putSessionData(org.vertx.java.core.http.HttpServerRequest req, String key, String obj, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
req
- The http server request.key
- The name of the field to put data into.obj
- The String to store.doneHandler
- The handler to call after storing finished. It will receive the message sent by
the session manager.public void putSessionData(String sessionId, org.vertx.java.core.json.JsonObject obj)
sessionId
- The id of the session.obj
- A JsonObject which provides key-value pairs.public void putSessionData(String sessionId, String key, org.vertx.java.core.json.JsonArray obj)
sessionId
- The id of the session.key
- The name of the field to put data into.obj
- The JsonArray to store.public void putSessionData(String sessionId, String key, byte[] obj)
sessionId
- The id of the session.key
- The name of the field to put data into.obj
- The byte array to store.public void putSessionData(String sessionId, String key, boolean obj)
sessionId
- The id of the session.key
- The name of the field to put data into.obj
- The JsonArray to store.public void putSessionData(String sessionId, String key, Number obj)
sessionId
- The id of the session.key
- The name of the field to put data into.obj
- The number to store.public void putSessionData(String sessionId, String key, org.vertx.java.core.json.JsonObject obj)
sessionId
- The id of the session.key
- The name of the field to put data into.obj
- The JsonObject to store.public void putSessionData(String sessionId, String key, String obj)
sessionId
- The id of the session.key
- The name of the field to put data into.obj
- The String to store.public void putSessionData(String sessionId, org.vertx.java.core.json.JsonObject obj, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
sessionId
- The id of the session.obj
- A JsonObject which provides key-value pairs.doneHandler
- The handler to call after storing finished. It will receive the message sent by
the session manager.public void putSessionData(String sessionId, String key, org.vertx.java.core.json.JsonArray obj, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
sessionId
- The id of the session.key
- The name of the field to put data into.obj
- The JsonArray to store.doneHandler
- The handler to call after storing finished. It will receive the message sent by
the session manager.public void putSessionData(String sessionId, String key, byte[] obj, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
sessionId
- The id of the session.key
- The name of the field to put data into.obj
- The byte array to store.doneHandler
- The handler to call after storing finished. It will receive the message sent by
the session manager.public void putSessionData(String sessionId, String key, boolean obj, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
sessionId
- The id of the session.key
- The name of the field to put data into.obj
- The JsonArray to store.doneHandler
- The handler to call after storing finished. It will receive the message sent by
the session manager.public void putSessionData(String sessionId, String key, Number obj, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
sessionId
- The id of the session.key
- The name of the field to put data into.obj
- The number to store.doneHandler
- The handler to call after storing finished. It will receive the message sent by
the session manager.public void putSessionData(String sessionId, String key, org.vertx.java.core.json.JsonObject obj, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
sessionId
- The id of the session.key
- The name of the field to put data into.obj
- The JsonObject to store.doneHandler
- The handler to call after storing finished. It will receive the message sent by
the session manager.public void putSessionData(String sessionId, String key, String obj, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
sessionId
- The id of the session.key
- The name of the field to put data into.obj
- The String to store.doneHandler
- The handler to call after storing finished. It will receive the message sent by
the session manager.public void withSessionId(org.vertx.java.core.http.HttpServerRequest req, org.vertx.java.core.Handler<String> handler)
req
- The http server request.handler
- The handler to call with the created or found session id.public String getSessionId(org.vertx.java.core.http.HttpServerRequest req)
public void startSession(org.vertx.java.core.http.HttpServerRequest req, org.vertx.java.core.Handler<String> handlerWithSessionId)
req
- The http server request, i.e. client, to create a session for.handlerWithSessionId
- A handler to use the created session id with.public void destroySession(String sessionId, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
sessionId
- The id of the session to destroy.doneHandler
- The handler to call with the result of the session manager.public void checkAllSessionsForMatch(org.vertx.java.core.json.JsonObject json, org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> doneHandler)
json
- The JsonObject to check against all sessions.doneHandler
- Handles the result of the session manager.public void withConnectionStats(org.vertx.java.core.Handler<org.vertx.java.core.json.JsonObject> handler)
handler
- The handler to call after getting the results of the connections report.Copyright © 2015. All rights reserved.