1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
package org.apache.tapestry.web; |
16 |
|
|
17 |
|
import java.util.List; |
18 |
|
|
19 |
|
import javax.servlet.http.HttpSession; |
20 |
|
|
21 |
|
import org.apache.hivemind.util.Defense; |
22 |
|
import org.apache.tapestry.describe.DescriptionReceiver; |
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
public class ServletWebSession implements WebSession |
32 |
|
{ |
33 |
|
private final HttpSession _httpSession; |
34 |
|
|
35 |
|
public ServletWebSession(HttpSession session) |
36 |
7 |
{ |
37 |
7 |
Defense.notNull(session, "session"); |
38 |
|
|
39 |
7 |
_httpSession = session; |
40 |
7 |
} |
41 |
|
|
42 |
|
public void describeTo(DescriptionReceiver receiver) |
43 |
|
{ |
44 |
0 |
receiver.describeAlternate(_httpSession); |
45 |
0 |
} |
46 |
|
|
47 |
|
public List getAttributeNames() |
48 |
|
{ |
49 |
1 |
return WebUtils.toSortedList(_httpSession.getAttributeNames()); |
50 |
|
} |
51 |
|
|
52 |
|
public Object getAttribute(String name) |
53 |
|
{ |
54 |
1 |
return _httpSession.getAttribute(name); |
55 |
|
} |
56 |
|
|
57 |
|
public void setAttribute(String name, Object attribute) |
58 |
|
{ |
59 |
2 |
if (attribute == null) |
60 |
1 |
_httpSession.removeAttribute(name); |
61 |
|
else |
62 |
1 |
_httpSession.setAttribute(name, attribute); |
63 |
2 |
} |
64 |
|
|
65 |
|
public String getId() |
66 |
|
{ |
67 |
1 |
return _httpSession.getId(); |
68 |
|
} |
69 |
|
|
70 |
|
public boolean isNew() |
71 |
|
{ |
72 |
0 |
return _httpSession.isNew(); |
73 |
|
} |
74 |
|
|
75 |
|
public void invalidate() |
76 |
|
{ |
77 |
1 |
_httpSession.invalidate(); |
78 |
1 |
} |
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
public long getCreationTime() |
84 |
|
{ |
85 |
0 |
return _httpSession.getCreationTime(); |
86 |
|
} |
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
public long getLastAccessedTime() |
92 |
|
{ |
93 |
0 |
return _httpSession.getLastAccessedTime(); |
94 |
|
} |
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
public int getMaxInactiveInterval() |
100 |
|
{ |
101 |
0 |
return _httpSession.getMaxInactiveInterval(); |
102 |
|
} |
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
public void setMaxInactiveInterval(int interval) |
108 |
|
{ |
109 |
0 |
_httpSession.setMaxInactiveInterval(interval); |
110 |
0 |
} |
111 |
|
} |