Package com.jetdrone.vertx.yoke.store.json

Examples of com.jetdrone.vertx.yoke.store.json.SessionObject


        // call us when headers are being set for the response
        response.headersHandler(new Handler<Void>() {
            @Override
            public void handle(Void done) {
              SessionObject session = request.get("session");
                String sessionId = session == null ? null : session.getString("id");

                // removed
                if (sessionId == null) {
                    if (sessionCookie != null) {
                        cookie.setValue("");
View Full Code Here


    // Session management

    /** Destroys a session from the request context and also from the storage engine.
     */
    public void destroySession() {
      SessionObject session = get("session");
        if (session == null) {
            return;
        }

        String sessionId = session.getString("id");
        // remove from the context
        put("session", null);

        if (sessionId == null) {
            return;
View Full Code Here

        store.get(sessionId, new Handler<JsonObject>() {
            @Override
            public void handle(JsonObject session) {
                if (session != null) {
                    put("session", new SessionObject(session));
                }

                response().headersHandler(new Handler<Void>() {
                    @Override
                    public void handle(Void event) {
                        int responseStatus = response().getStatusCode();
                        // Only save on success and redirect status codes
                        if (responseStatus >= 200 && responseStatus < 400) {
                          SessionObject session = get("session");
                            if (session != null && session.isChanged()) {
                                store.set(sessionId, session.jsonObject(), new Handler<Object>() {
                                    @Override
                                    public void handle(Object error) {
                                        if (error != null) {
                                            // TODO: better handling of errors
                                            System.err.println(error);
View Full Code Here

     * @return {JsonObject} session
     */
    public JsonObject createSession(@NotNull final String sessionId) {
        final JsonObject session = new JsonObject().putString("id", sessionId);

        put("session", new SessionObject(session, true));

        response().headersHandler(new Handler<Void>() {
            @Override
            public void handle(Void event) {
                int responseStatus = response().getStatusCode();
                // Only save on success and redirect status codes
                if (responseStatus >= 200 && responseStatus < 400) {
                  SessionObject session = get("session");
                    if (session != null && session.isChanged()) {
                        store.set(sessionId, session.jsonObject(), new Handler<Object>() {
                            @Override
                            public void handle(Object error) {
                                if (error != null) {
                                    // TODO: better handling of errors
                                    System.err.println(error);
View Full Code Here

TOP

Related Classes of com.jetdrone.vertx.yoke.store.json.SessionObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.