1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.shiro.web.session.mgt;
17
18 import org.apache.shiro.session.mgt.DefaultSessionKey;
19 import org.apache.shiro.web.util.RequestPairSource;
20
21 import javax.servlet.ServletRequest;
22 import javax.servlet.ServletResponse;
23 import java.io.Serializable;
24
25
26
27
28
29
30
31
32 public class WebSessionKey extends DefaultSessionKey implements RequestPairSource {
33
34 private final ServletRequest servletRequest;
35 private final ServletResponse servletResponse;
36
37 public WebSessionKey(ServletRequest request, ServletResponse response) {
38 if (request == null) {
39 throw new NullPointerException("request argument cannot be null.");
40 }
41 if (response == null) {
42 throw new NullPointerException("response argument cannot be null.");
43 }
44 this.servletRequest = request;
45 this.servletResponse = response;
46 }
47
48 public WebSessionKey(Serializable sessionId, ServletRequest request, ServletResponse response) {
49 this(request, response);
50 setSessionId(sessionId);
51 }
52
53 public ServletRequest getServletRequest() {
54 return servletRequest;
55 }
56
57 public ServletResponse getServletResponse() {
58 return servletResponse;
59 }
60 }