Salome HOME
The bug related to the end of session is fixed. redirectOnEndOfSession interceptor...
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / InvalidateAction.java
1 /*****************************************************************************
2  * Company         OPEN CASCADE
3  * Application     SIMAN
4  * File            $Id$ 
5  * Creation date   10.01.2013
6  * @author         $Author$
7  * @version        $Revision$
8  * @copyright      OPEN CASCADE 2012
9  *****************************************************************************/
10
11 package org.splat.simer;
12
13 import java.util.Map;
14
15 import org.apache.struts2.ServletActionContext;
16 import org.apache.struts2.interceptor.SessionAware;
17
18 import com.opensymphony.xwork2.ActionSupport;
19
20 /**
21  * The action to invalidate http session.
22  * 
23  * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
24  */
25 public class InvalidateAction extends ActionSupport implements SessionAware {
26
27         /**
28          * Serial version UID.
29          */
30         private static final long serialVersionUID = -4418374434097351120L;
31
32         /**
33          * Http session container.
34          */
35         private Map<String, Object> _session;
36         
37         /**
38          * Invalidate the current session.
39          * @return "home"
40          */
41         public String doInvalidate() {
42                 if (_session != null) {
43                         _session.clear();
44                 }
45                 ServletActionContext.getRequest().getSession().invalidate();
46                 return SUCCESS;
47         }
48
49         /** 
50          * {@inheritDoc}
51          * @see org.apache.struts2.interceptor.SessionAware#setSession(java.util.Map)
52          */
53         @Override
54         public void setSession(final Map<String, Object> session) {
55                 _session = session;
56         }
57 }