1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.shiro.web.session.mgt; |
20 | |
|
21 | |
import org.apache.shiro.session.mgt.DefaultSessionContext; |
22 | |
|
23 | |
import javax.servlet.ServletRequest; |
24 | |
import javax.servlet.ServletResponse; |
25 | |
import java.util.Map; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
public class DefaultWebSessionContext extends DefaultSessionContext implements WebSessionContext { |
34 | |
|
35 | |
private static final long serialVersionUID = -3974604687792523072L; |
36 | |
|
37 | 2 | private static final String SERVLET_REQUEST = DefaultWebSessionContext.class.getName() + ".SERVLET_REQUEST"; |
38 | 2 | private static final String SERVLET_RESPONSE = DefaultWebSessionContext.class.getName() + ".SERVLET_RESPONSE"; |
39 | |
|
40 | |
public DefaultWebSessionContext() { |
41 | 14 | super(); |
42 | 14 | } |
43 | |
|
44 | |
public DefaultWebSessionContext(Map<String, Object> map) { |
45 | 0 | super(map); |
46 | 0 | } |
47 | |
|
48 | |
public void setServletRequest(ServletRequest request) { |
49 | 14 | if (request != null) { |
50 | 14 | put(SERVLET_REQUEST, request); |
51 | |
} |
52 | 14 | } |
53 | |
|
54 | |
public ServletRequest getServletRequest() { |
55 | 42 | return getTypedValue(SERVLET_REQUEST, ServletRequest.class); |
56 | |
} |
57 | |
|
58 | |
public void setServletResponse(ServletResponse response) { |
59 | 14 | if (response != null) { |
60 | 14 | put(SERVLET_RESPONSE, response); |
61 | |
} |
62 | 14 | } |
63 | |
|
64 | |
public ServletResponse getServletResponse() { |
65 | 36 | return getTypedValue(SERVLET_RESPONSE, ServletResponse.class); |
66 | |
} |
67 | |
} |