01: package com.ibatis.struts.httpmap;
02:
03: import java.util.Enumeration;
04:
05: import javax.servlet.http.HttpServletRequest;
06: import javax.servlet.http.HttpSession;
07:
08: /**
09: * Map to wrap session scope attributes. <p/>Date: Mar 11, 2004 10:35:42 PM
10: *
11: * @author Clinton Begin
12: */
13: public class SessionMap extends BaseHttpMap {
14:
15: private HttpSession session;
16:
17: public SessionMap(HttpServletRequest request) {
18: this .session = request.getSession();
19: }
20:
21: protected Enumeration getNames() {
22: return session.getAttributeNames();
23: }
24:
25: protected Object getValue(Object key) {
26: return session.getAttribute(String.valueOf(key));
27: }
28:
29: protected void putValue(Object key, Object value) {
30: session.setAttribute(String.valueOf(key), value);
31: }
32:
33: protected void removeValue(Object key) {
34: session.removeAttribute(String.valueOf(key));
35: }
36:
37: }
|