1 package org.andromda.cartridges.jsf.portlet.myfaces.tomahawk.support;
2
3 import java.util.ArrayList;
4 import java.util.Enumeration;
5 import java.util.List;
6 import javax.portlet.PortletContext;
7 import javax.portlet.PortletSession;
8 import javax.servlet.ServletContext;
9 import javax.servlet.http.HttpSession;
10 import javax.servlet.http.HttpSessionContext;
11
12
13
14
15
16
17 @SuppressWarnings("deprecation")
18 public class HttpSessionWrapper
19 implements HttpSession
20 {
21 private final PortletSession portletSession;
22 private final PortletContext portletContext;
23
24
25
26
27
28 public HttpSessionWrapper(
29 final PortletSession portletSession,
30 final PortletContext portletContext)
31 {
32 this.portletSession = portletSession;
33 this.portletContext = portletContext;
34 }
35
36
37
38
39 public long getCreationTime()
40 {
41 return portletSession.getCreationTime();
42 }
43
44
45
46
47 public String getId()
48 {
49 return portletSession.getId();
50 }
51
52
53
54
55 public long getLastAccessedTime()
56 {
57 return portletSession.getLastAccessedTime();
58 }
59
60
61
62
63 public ServletContext getServletContext()
64 {
65 return new ServletContextWrapper(portletContext);
66 }
67
68
69
70
71 public void setMaxInactiveInterval(final int arg0)
72 {
73 portletSession.setMaxInactiveInterval(arg0);
74 }
75
76
77
78
79 public int getMaxInactiveInterval()
80 {
81 return portletSession.getMaxInactiveInterval();
82 }
83
84
85
86
87
88
89 @Deprecated
90 public HttpSessionContext getSessionContext()
91 {
92
93 return null;
94 }
95
96
97
98
99 public Object getAttribute(final String arg0)
100 {
101 return portletSession.getAttribute(arg0);
102 }
103
104
105
106
107
108 @Deprecated
109 public Object getValue(final String arg0)
110 {
111 return portletSession.getAttribute(arg0);
112 }
113
114
115
116
117 public Enumeration getAttributeNames()
118 {
119 return portletSession.getAttributeNames();
120 }
121
122
123
124
125
126 @Deprecated
127 public String[] getValueNames()
128 {
129 final List objs = new ArrayList();
130 for (final Enumeration e = portletSession.getAttributeNames(); e.hasMoreElements();)
131 {
132 final String key = (String)e.nextElement();
133 objs.add(key);
134 }
135 final String[] values = new String[objs.size()];
136 for (int i = 0; i < objs.size(); i++)
137 {
138 values[i] = (String)objs.get(i);
139 }
140 return values;
141 }
142
143
144
145
146 public void setAttribute(final String arg0, final Object arg1)
147 {
148 portletSession.setAttribute(arg0, arg1);
149 }
150
151
152
153
154
155 @Deprecated
156 public void putValue(final String arg0, final Object arg1)
157 {
158 portletSession.setAttribute(arg0, arg1);
159 }
160
161
162
163
164 public void removeAttribute(final String arg0)
165 {
166 portletSession.removeAttribute(arg0);
167 }
168
169
170
171
172
173 @Deprecated
174 public void removeValue(final String arg0)
175 {
176 portletSession.removeAttribute(arg0);
177 }
178
179
180
181
182 public void invalidate()
183 {
184 portletSession.invalidate();
185 }
186
187
188
189
190 public boolean isNew()
191 {
192 return portletSession.isNew();
193 }
194 }