1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.shiro.session.mgt;
20
21 import org.apache.shiro.util.MapContext;
22 import org.apache.shiro.util.StringUtils;
23
24 import java.io.Serializable;
25 import java.util.Map;
26
27
28
29
30
31
32
33 public class DefaultSessionContext extends MapContext implements SessionContext {
34
35 private static final long serialVersionUID = -1424160751361252966L;
36
37 private static final String HOST = DefaultSessionContext.class.getName() + ".HOST";
38 private static final String SESSION_ID = DefaultSessionContext.class.getName() + ".SESSION_ID";
39
40 public DefaultSessionContext() {
41 super();
42 }
43
44 public DefaultSessionContext(Map<String, Object> map) {
45 super(map);
46 }
47
48 public String getHost() {
49 return getTypedValue(HOST, String.class);
50 }
51
52 public void setHost(String host) {
53 if (StringUtils.hasText(host)) {
54 put(HOST, host);
55 }
56 }
57
58 public Serializable getSessionId() {
59 return getTypedValue(SESSION_ID, Serializable.class);
60 }
61
62 public void setSessionId(Serializable sessionId) {
63 nullSafePut(SESSION_ID, sessionId);
64 }
65 }