I implemented a very simple script to call a logout action:
| <!-- 10 minutes timeout -->
| <script type="text/javascript"
language="JavaScript"><!--
| setTimeout('Redirect()', 600000);
| function Redirect() {
| document.getElementById('tor_form:tor_button').click();
| }
| // --></script>
|
| [...]
|
| <h:form id="tor_form">
| <t:commandButton id="tor_button" style="display:none;"
value="redirect" action="#{logout.logout}"/>
| </h:form>
|
|
The logout action invalidates the session and redirects to the login page:
| // Before invalidating the whole session check if other conversations
| // are running
| if(!ConversationsAgent.getInstance().activeConversationsExist()) {
| Seam.invalidateSession();
| return "login";
| }
|
| // Otherwise leave session open and just redirect to home
| else {
| ConversationsAgent.getInstance().end();
| FacesMessages.instance().add("No activity timeout occurred.");
| return "home";
| }
|
I added the if/else conditions because if I invalidate the session all active
conversations (in other tabs) will be destroyed and this is not what I want. I implemented
the activeConversationsExist() as it follows:
| public boolean activeConversationsExist() {
| for (ConversationEntry entry :
ConversationEntries.instance().getConversationEntries()) {
| if(!entry.isEnded())
| return true;
| }
| return false;
| }
|
which is not good because it checks the whole conversation stack (including other
connected clients or browsers) and not the ones related to the session I want to
invalidate.
So, my question is: is there a way to check if only the session-related conversations are
ended?
Thanx, cheers!
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069064#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...