FileDocCategorySizeDatePackage
AttributeMap.javaAPI DocExample3940Mon Jul 23 13:26:56 BST 2007org.apache.struts2.util

AttributeMap

public class AttributeMap extends Object implements Map
A Map that holds 4 levels of scope.

The scopes are the ones known in the web world.:

  • Page scope
  • Request scope
  • Session scope
  • Application scope
A object is searched in the order above, starting from page and ending at application scope.

Fields Summary
protected static final String
UNSUPPORTED
Map
context
Constructors Summary
public AttributeMap(Map context)



       
        this.context = context;
    
Methods Summary
public voidclear()

        throw new UnsupportedOperationException(UNSUPPORTED);
    
public booleancontainsKey(java.lang.Object key)

        return (get(key) != null);
    
public booleancontainsValue(java.lang.Object value)

        throw new UnsupportedOperationException(UNSUPPORTED);
    
public java.util.SetentrySet()

        return Collections.EMPTY_SET;
    
public java.lang.Objectget(java.lang.Object key)

        PageContext pc = getPageContext();

        if (pc == null) {
            Map request = (Map) context.get("request");
            Map session = (Map) context.get("session");
            Map application = (Map) context.get("application");

            if ((request != null) && (request.get(key) != null)) {
                return request.get(key);
            } else if ((session != null) && (session.get(key) != null)) {
                return session.get(key);
            } else if ((application != null) && (application.get(key) != null)) {
                return application.get(key);
            }
        } else {
            try{
                return pc.findAttribute(key.toString());
            }catch (NullPointerException npe){
                return null;
            }
        }

        return null;
    
private javax.servlet.jsp.PageContextgetPageContext()

        return (PageContext) context.get(ServletActionContext.PAGE_CONTEXT);
    
public booleanisEmpty()

        throw new UnsupportedOperationException(UNSUPPORTED);
    
public java.util.SetkeySet()

        return Collections.EMPTY_SET;
    
public java.lang.Objectput(java.lang.Object key, java.lang.Object value)

        PageContext pc = getPageContext();
        if (pc != null) {
            pc.setAttribute(key.toString(), value);
        }

        return null;
    
public voidputAll(java.util.Map t)

        throw new UnsupportedOperationException(UNSUPPORTED);
    
public java.lang.Objectremove(java.lang.Object key)

        throw new UnsupportedOperationException(UNSUPPORTED);
    
public intsize()

        throw new UnsupportedOperationException(UNSUPPORTED);
    
public java.util.Collectionvalues()

        return Collections.EMPTY_SET;