Methods Summary |
---|
public void | clear()Removes all attributes from the request as well as clears entries in this map.
entries = null;
Enumeration keys = request.getAttributeNames();
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
request.removeAttribute(key);
}
|
public java.util.Set | entrySet()Returns a Set of attributes from the http request.
if (entries == null) {
entries = new HashSet<Object>();
Enumeration enumeration = request.getAttributeNames();
while (enumeration.hasMoreElements()) {
final String key = enumeration.nextElement().toString();
final Object value = request.getAttribute(key);
entries.add(new Entry() {
public boolean equals(Object obj) {
Entry entry = (Entry) obj;
return ((key == null) ? (entry.getKey() == null) : key.equals(entry.getKey())) && ((value == null) ? (entry.getValue() == null) : value.equals(entry.getValue()));
}
public int hashCode() {
return ((key == null) ? 0 : key.hashCode()) ^ ((value == null) ? 0 : value.hashCode());
}
public Object getKey() {
return key;
}
public Object getValue() {
return value;
}
public Object setValue(Object obj) {
request.setAttribute(key.toString(), obj);
return value;
}
});
}
}
return entries;
|
public java.lang.Object | get(java.lang.Object key)Returns the request attribute associated with the given key or null if it doesn't exist.
return request.getAttribute(key.toString());
|
public java.lang.Object | put(java.lang.Object key, java.lang.Object value)Saves an attribute in the request.
entries = null;
request.setAttribute(key.toString(), value);
return get(key);
|
public java.lang.Object | remove(java.lang.Object key)Removes the specified request attribute.
entries = null;
Object value = get(key);
request.removeAttribute(key.toString());
return value;
|