1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 package groovy.servlet;
47
48 import javax.servlet.ServletContext;
49 import javax.servlet.ServletRequest;
50 import javax.servlet.http.HttpSession;
51 import javax.servlet.jsp.PageContext;
52
53 /***
54 * Servlet support.
55 */
56 public class ServletCategory {
57
58 public static Object get(ServletContext context, String key) {
59 return context.getAttribute(key);
60 }
61
62 public static Object get(HttpSession session, String key) {
63 return session.getAttribute(key);
64 }
65
66 public static Object get(ServletRequest request, String key) {
67 return request.getAttribute(key);
68 }
69
70 public static Object get(PageContext context, String key) {
71 return context.getAttribute(key);
72 }
73
74 public static Object getAt(ServletContext context, String key) {
75 return context.getAttribute(key);
76 }
77
78 public static Object getAt(HttpSession session, String key) {
79 return session.getAttribute(key);
80 }
81
82 public static Object getAt(ServletRequest request, String key) {
83 return request.getAttribute(key);
84 }
85
86 public static Object getAt(PageContext context, String key) {
87 return context.getAttribute(key);
88 }
89
90 public static void set(ServletContext context, String key, Object value) {
91 context.setAttribute(key, value);
92 }
93
94 public static void set(HttpSession session, String key, Object value) {
95 session.setAttribute(key, value);
96 }
97
98 public static void set(ServletRequest request, String key, Object value) {
99 request.setAttribute(key, value);
100 }
101
102 public static void set(PageContext context, String key, Object value) {
103 context.setAttribute(key, value);
104 }
105
106 public static void putAt(ServletContext context, String key, Object value) {
107 context.setAttribute(key, value);
108 }
109
110 public static void putAt(HttpSession session, String key, Object value) {
111 session.setAttribute(key, value);
112 }
113
114 public static void putAt(ServletRequest request, String key, Object value) {
115 request.setAttribute(key, value);
116 }
117
118 public static void putAt(PageContext context, String key, Object value) {
119 context.setAttribute(key, value);
120 }
121
122 }