1
2
3
4
5
6
7 package groovy.servlet;
8
9 import javax.servlet.ServletContext;
10 import javax.servlet.ServletRequest;
11 import javax.servlet.http.HttpSession;
12 import javax.servlet.jsp.PageContext;
13
14 /***
15 * @author sam
16 *
17 * TODO To change the template for this generated type comment go to
18 * Window - Preferences - Java - Code Generation - Code and Comments
19 */
20 public class ServletCategory {
21
22 /***
23 * Servlet support
24 */
25 public static Object get(ServletContext context, String key) {
26 return context.getAttribute(key);
27 }
28
29 public static Object get(HttpSession session, String key) {
30 return session.getAttribute(key);
31 }
32
33 public static Object get(ServletRequest request, String key) {
34 return request.getAttribute(key);
35 }
36
37 public static Object get(PageContext context, String key) {
38 return context.getAttribute(key);
39 }
40
41 public static Object getAt(ServletContext context, String key) {
42 return context.getAttribute(key);
43 }
44
45 public static Object getAt(HttpSession session, String key) {
46 return session.getAttribute(key);
47 }
48
49 public static Object getAt(ServletRequest request, String key) {
50 return request.getAttribute(key);
51 }
52
53 public static Object getAt(PageContext context, String key) {
54 return context.getAttribute(key);
55 }
56
57 public static void set(ServletContext context, String key, Object value) {
58 context.setAttribute(key, value);
59 }
60
61 public static void set(HttpSession session, String key, Object value) {
62 session.setAttribute(key, value);
63 }
64
65 public static void set(ServletRequest request, String key, Object value) {
66 request.setAttribute(key, value);
67 }
68
69 public static void set(PageContext context, String key, Object value) {
70 context.setAttribute(key, value);
71 }
72
73 public static void putAt(ServletContext context, String key, Object value) {
74 context.setAttribute(key, value);
75 }
76
77 public static void putAt(HttpSession session, String key, Object value) {
78 session.setAttribute(key, value);
79 }
80
81 public static void putAt(ServletRequest request, String key, Object value) {
82 request.setAttribute(key, value);
83 }
84
85 public static void putAt(PageContext context, String key, Object value) {
86 context.setAttribute(key, value);
87 }
88
89 }