1 16 package org.apache.cocoon.faces.context; 17 18 import org.apache.cocoon.environment.Request; 19 20 import java.util.Enumeration ; 21 import java.util.HashSet ; 22 import java.util.Set ; 23 24 30 class RequestMap extends BaseMap { 31 32 private Request request; 33 34 35 RequestMap(Request request) { 36 this.request = request; 37 } 38 39 public Object get(Object key) { 40 return request.getAttribute(key.toString()); 41 } 42 43 public Object put(Object key, Object value) { 44 String sKey = key.toString(); 45 Object old = request.getAttribute(sKey); 46 request.setAttribute(sKey, value); 47 return old; 48 } 49 50 public Object remove(Object key) { 51 String sKey = key.toString(); 52 Object old = request.getAttribute(sKey); 53 request.removeAttribute(sKey); 54 return old; 55 } 56 57 public Set entrySet() { 58 Set entries = new HashSet (); 59 for (Enumeration e = request.getAttributeNames(); e.hasMoreElements();) { 60 String name = (String ) e.nextElement(); 61 entries.add(new BaseMap.Entry(name, request.getAttribute(name))); 62 } 63 64 return entries; 65 } 66 67 public boolean equals(Object obj) { 68 if (obj == null || !(obj instanceof RequestMap)) { 69 return false; 70 } 71 72 return super.equals(obj); 73 } 74 } 75 | Popular Tags |