1 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 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 } 123 | Popular Tags |