Search in sources :

Example 11 with Session

use of com.networknt.session.Session in project light-session-4j by networknt.

the class RedisSessionManager method getSession.

@Override
public Session getSession(final HttpServerExchange serverExchange) {
    if (serverExchange != null) {
        RedisSessionRepository.RedisSession newSession = serverExchange.getAttachment(NEW_SESSION);
        if (newSession != null) {
            return newSession;
        }
    }
    String sessionId = sessionConfig.findSessionId(serverExchange);
    Session session = getSession(sessionId);
    if (session == null) {
        sessionConfig.clearSession(serverExchange, sessionId);
    }
    return session;
}
Also used : Session(com.networknt.session.Session)

Example 12 with Session

use of com.networknt.session.Session in project light-session-4j by networknt.

the class RedisSessionManager method removeSession.

@Override
public Session removeSession(HttpServerExchange serverExchange) {
    if (serverExchange != null) {
        String sessionId = sessionConfig.findSessionId(serverExchange);
        Session oldSession = serverExchange.removeAttachment(NEW_SESSION);
        removeSession(sessionId);
        return oldSession;
    }
    return null;
}
Also used : Session(com.networknt.session.Session)

Aggregations

Session (com.networknt.session.Session)12 SessionManager (com.networknt.session.SessionManager)6 HttpString (io.undertow.util.HttpString)6 MapSession (com.networknt.session.MapSession)2