KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opencms > core > CmsSession


1 /*
2 * File : $Source: /usr/local/cvs/opencms/src-modules/com/opencms/core/CmsSession.java,v $
3 * Date : $Date: 2005/05/17 13:47:28 $
4 * Version: $Revision: 1.1 $
5 *
6 * This library is part of OpenCms -
7 * the Open Source Content Mananagement System
8 *
9 * Copyright (C) 2001 The OpenCms Group
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * For further information about OpenCms, please see the
22 * OpenCms Website: http://www.opencms.org
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 */

28
29 package com.opencms.core;
30
31 import javax.servlet.http.HttpSession JavaDoc;
32
33 /**
34  * Implements the I_CmsSession interface and is required by the OpenCms session
35  * handling mechanism.<p>
36  *
37  * This <code>CmsSession</code> object should be used instead of the
38  * <code>HttpSession</code>.
39  *
40  * @author Michael Emmerich
41  *
42  * @version $Revision: 1.1 $ $Date: 2005/05/17 13:47:28 $
43  *
44  * @deprecated Will not be supported past the OpenCms 6 release.
45  */

46 public class CmsSession implements I_CmsSession {
47
48     /**
49      * The original HttpSession.
50      */

51     private HttpSession JavaDoc m_session;
52
53     /**
54      * Constructs a new CmsSession based on a HttpSession.
55      *
56      * @param originalSession the original session to use.
57      */

58     public CmsSession(HttpSession JavaDoc originalSession) {
59         m_session = originalSession;
60     }
61
62     /**
63      * Gets a value from the session.
64      *
65      * @param name the key for the value.
66      * @return the object associated with this key.
67      */

68     public Object JavaDoc getValue(String JavaDoc name) {
69         return m_session.getAttribute(name);
70     }
71
72     /**
73      * Puts a value into the session.
74      *
75      * @param name the key for the value.
76      * @param value an object to be stored in the session.
77      */

78     public void putValue(String JavaDoc name, Object JavaDoc value) {
79         m_session.setAttribute(name, value);
80     }
81
82     /**
83      * Removes a value from the session.
84      *
85      * @param name the key for the value to be removed.
86      */

87     public void removeValue(String JavaDoc name) {
88         m_session.removeAttribute(name);
89     }
90     
91     /**
92      * Gets the Session Id.<p>
93      *
94      * @return session id
95      */

96     public String JavaDoc getId() {
97         return m_session.getId();
98     }
99     
100     
101     /**
102      * Invalidates the session.
103      */

104     public void invalidate() {
105         if (m_session != null) {
106             m_session.invalidate();
107         }
108     }
109 }
110
Popular Tags