Example usage for org.apache.wicket Session SESSION_ATTRIBUTE_NAME

List of usage examples for org.apache.wicket Session SESSION_ATTRIBUTE_NAME

Introduction

In this page you can find the example usage for org.apache.wicket Session SESSION_ATTRIBUTE_NAME.

Prototype

String SESSION_ATTRIBUTE_NAME

To view the source code for org.apache.wicket Session SESSION_ATTRIBUTE_NAME.

Click Source Link

Document

Name of session attribute under which this session is stored

Usage

From source file:RedisSessionStore.java

License:Apache License

@Override
public void bind(Request request, Session newSession) {
    if (getAttribute(request, Session.SESSION_ATTRIBUTE_NAME) != newSession) {
        // call template method
        onBind(request, newSession);/* ww w .j a  v a  2s . com*/
        for (BindListener listener : getBindListeners()) {
            listener.bindingSession(request, newSession);
        }

        HttpSession httpSession = getHttpSession(request, false);

        if (httpSession != null) {
            // register an unbinding listener for cleaning up
            String applicationKey = Application.get().getName();
            httpSession.setAttribute("Wicket:SessionUnbindingListener-" + applicationKey,
                    new SessionBindingListener(applicationKey, newSession));
        }
        // register the session object itself
        setAttribute(request, Session.SESSION_ATTRIBUTE_NAME, newSession);
    }
}

From source file:RedisSessionStore.java

License:Apache License

@Override
public Session lookup(Request request) {
    String sessionId = getSessionId(request, false);
    if (sessionId != null) {
        return (Session) getAttribute(request, Session.SESSION_ATTRIBUTE_NAME);
    }/* w  ww. ja  va  2s .  com*/
    return null;
}

From source file:RedisSessionStore.java

License:Apache License

@Override
public void flushSession(Request request, Session session) {
    if (getAttribute(request, Session.SESSION_ATTRIBUTE_NAME) != session) {
        // this session is not yet bound, bind it
        bind(request, session);//from w  w  w .  j ava 2s  .  co  m
    } else {
        setAttribute(request, Session.SESSION_ATTRIBUTE_NAME, session);
    }
}

From source file:bugs.HttpSessionStoreModified.java

License:Apache License

/**
 * @see org.apache.wicket.session.ISessionStore#bind(Request, Session)
 *///from  ww  w .  j a va 2  s.  co m
@Override
public final void bind(final Request request, final Session newSession) {
    if (getAttribute(request, Session.SESSION_ATTRIBUTE_NAME) != newSession) {
        // call template method
        onBind(request, newSession);
        for (BindListener listener : getBindListeners()) {
            listener.bindingSession(request, newSession);
        }

        HttpSession httpSession = getHttpSession(request, false);

        if (httpSession != null) {
            // register an unbinding listener for cleaning up
            String applicationKey = Application.get().getName();
            httpSession.setAttribute("Wicket:SessionUnbindingListener-" + applicationKey,
                    new SessionBindingListener(applicationKey, newSession));

            // register the session object itself
            setAttribute(request, Session.SESSION_ATTRIBUTE_NAME, newSession);
        }
    }
}

From source file:bugs.HttpSessionStoreModified.java

License:Apache License

/**
 * @see org.apache.wicket.session.ISessionStore#lookup(org.apache.wicket.request.Request)
 *//* ww  w .ja v  a 2 s  .c  om*/
@Override
public final Session lookup(final Request request) {
    String sessionId = getSessionId(request, false);
    if (sessionId != null) {
        return (Session) getAttribute(request, Session.SESSION_ATTRIBUTE_NAME);
    }
    return null;
}

From source file:com.mastfrog.acteur.wicket.ActeurSessionStore.java

License:Apache License

/**
 * @see org.apache.wicket.session.ISessionStore#bind(Request, Session)
 *///from  w w w .  j  av  a 2s . co m
@Override
public final void bind(final Request request, final Session newSession) {
    if (getAttribute(request, Session.SESSION_ATTRIBUTE_NAME) != newSession) {
        // call template method
        onBind(request, newSession);
        for (BindListener listener : getBindListeners()) {
            listener.bindingSession(request, newSession);
        }

        Session httpSession = getHttpSession(request, false);

        if (httpSession != null) {
            // register an unbinding listener for cleaning up
            String applicationKey = Application.get().getName();
            httpSession.setAttribute("Wicket:SessionUnbindingListener-" + applicationKey,
                    new SessionBindingListener(applicationKey, newSession));

            // register the session object itself
            setAttribute(request, Session.SESSION_ATTRIBUTE_NAME, newSession);
        }
    }
}