01: package com.ibatis.struts.httpmap;
02:
03: import javax.servlet.ServletContext;
04: import javax.servlet.http.HttpServletRequest;
05: import java.util.Enumeration;
06:
07: /**
08: * Map to wrap application scope attributes. <p/>Date: Mar 11, 2004 11:21:25 PM
09: *
10: * @author Clinton Begin
11: */
12: public class ApplicationMap extends BaseHttpMap {
13:
14: private ServletContext context;
15:
16: public ApplicationMap(HttpServletRequest request) {
17: context = request.getSession().getServletContext();
18: }
19:
20: protected Enumeration getNames() {
21: return context.getAttributeNames();
22: }
23:
24: protected Object getValue(Object key) {
25: return context.getAttribute(String.valueOf(key));
26: }
27:
28: protected void putValue(Object key, Object value) {
29: context.setAttribute(String.valueOf(key), value);
30: }
31:
32: protected void removeValue(Object key) {
33: context.removeAttribute(String.valueOf(key));
34: }
35:
36: }
|