jsf 2 - conversation gets destroyed when invalidating a session -
i have sessionmanager implements httpsessionlistener. in sessionmanager, have static hashtable of active sessions. trying create function forcing invalidation of sessions. looks :
httpsession session = sessionregistry.get(key); session.invalidate();
absolutely want do, destroy targeted session. however, seems have side effect on @conversationscoped managed bean.
in conversationbean, have property holds value. noticed after invalidating session sessionregistry, value stored on conversationbean gets destroyed.
i invalidating different session (one sessionregistry , not current session) i printed value conversationbean before , after invalidating session , still there. gets destroyed 1 time leave @viewscoped page displaying list of active sessions . (caught using @predestroy) also, on @predestroy annotated method of @viewscoped bean, tried printing conversation id , nullified. , yes, hash code conversationbean different means different instance 1 had before invoking session.invalidate.---- edit ------
this illustration demonstrates trying accomplish :
let's have application scoped hashtable, sessionregistry, these values:
key | value --------------------- 1 | httpsession1 2 | httpsession2 3 | httpsession3
log in administrator. believe have different session, let's httpsession4. want seek kick session application scoped hashtable , this:
httpsession session = sessionregistry.get(1); session.invalidate();
destroyed httpsession1 while logged in on httpsession4. in understanding, conversation of httpsession1 should destroyed , not current conversation, should associated httpsession4.
question is, normal behavior of @conversationscoped managed beans? seemed associating on session invalidating.
quote official documentation:
when http servlet session invalidated, long-running conversation contexts created during current session destroyed, after servlet service() method completes.
jsf-2 cdi invalidate httpsession conversation-scope
No comments:
Post a Comment