geronimo-jsp_2.1_spec/src/main/java/javax/servlet/jsp/el/ImplicitObjectELResolver.java [180:550]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            feat.setPreferred(true);
            feat.setValue(RESOLVABLE_AT_DESIGN_TIME, Boolean.TRUE);
            feat.setValue(TYPE, String.class);
            feats.add(feat);
        }
        return feats.iterator();
    }

    public Class<String> getCommonPropertyType(ELContext context, Object base) {
        if (base == null) {
            return String.class;
        }
        return null;
    }

    private static class ScopeManager {
        private final static String MNGR_KEY = ScopeManager.class.getName();

        private final PageContext page;

        private Map applicationScope;

        private Map cookie;

        private Map header;

        private Map headerValues;

        private Map initParam;

        private Map pageScope;

        private Map param;

        private Map paramValues;

        private Map requestScope;

        private Map sessionScope;

        public ScopeManager(PageContext page) {
            this.page = page;
        }

        public static ScopeManager get(PageContext page) {
            ScopeManager mngr = (ScopeManager) page.getAttribute(MNGR_KEY);
            if (mngr == null) {
                mngr = new ScopeManager(page);
                page.setAttribute(MNGR_KEY, mngr);
            }
            return mngr;
        }

        public Map getApplicationScope() {
            if (this.applicationScope == null) {
                this.applicationScope = new ScopeMap() {
                    protected void setAttribute(String name, Object value) {
                        page.getServletContext().setAttribute(name, value);
                    }

                    protected void removeAttribute(String name) {
                        page.getServletContext().removeAttribute(name);
                    }

                    protected Enumeration getAttributeNames() {
                        return page.getServletContext().getAttributeNames();
                    }

                    protected Object getAttribute(String name) {
                        return page.getServletContext().getAttribute(name);
                    }
                };
            }
            return this.applicationScope;
        }

        public Map getCookie() {
            if (this.cookie == null) {
                this.cookie = new ScopeMap() {
                    protected Enumeration getAttributeNames() {
                        Cookie[] c = ((HttpServletRequest) page.getRequest())
                                .getCookies();
                        if (c != null) {
                            Vector v = new Vector();
                            for (int i = 0; i < c.length; i++) {
                                v.add(c[i].getName());
                            }
                            return v.elements();
                        }
                        return null;
                    }

                    protected Object getAttribute(String name) {
                        Cookie[] c = ((HttpServletRequest) page.getRequest())
                                .getCookies();
                        if (c != null) {
                            for (int i = 0; i < c.length; i++) {
                                if (name.equals(c[i].getName())) {
                                    return c[i];
                                }
                            }
                        }
                        return null;
                    }

                };
            }
            return this.cookie;
        }

        public Map getHeader() {
            if (this.header == null) {
                this.header = new ScopeMap() {
                    protected Enumeration getAttributeNames() {
                        return ((HttpServletRequest) page.getRequest())
                                .getHeaderNames();
                    }

                    protected Object getAttribute(String name) {
                        return ((HttpServletRequest) page.getRequest())
                                .getHeader(name);
                    }
                };
            }
            return this.header;
        }

        public Map getHeaderValues() {
            if (this.headerValues == null) {
                this.headerValues = new ScopeMap() {
                    protected Enumeration getAttributeNames() {
                        return ((HttpServletRequest) page.getRequest())
                                .getHeaderNames();
                    }

                    protected Object getAttribute(String name) {
                        Enumeration e = ((HttpServletRequest) page.getRequest())
                                .getHeaders(name);
                        if (e != null) {
                            List list = new ArrayList();
                            while (e.hasMoreElements()) {
                                list.add(e.nextElement().toString());
                            }
                            return (String[]) list.toArray(new String[list
                                    .size()]);
                        }
                        return null;
                    }

                };
            }
            return this.headerValues;
        }

        public Map getInitParam() {
            if (this.initParam == null) {
                this.initParam = new ScopeMap() {
                    protected Enumeration getAttributeNames() {
                        return page.getServletContext().getInitParameterNames();
                    }

                    protected Object getAttribute(String name) {
                        return page.getServletContext().getInitParameter(name);
                    }
                };
            }
            return this.initParam;
        }

        public PageContext getPageContext() {
            return this.page;
        }

        public Map getPageScope() {
            if (this.pageScope == null) {
                this.pageScope = new ScopeMap() {
                    protected void setAttribute(String name, Object value) {
                        page.setAttribute(name, value);
                    }

                    protected void removeAttribute(String name) {
                        page.removeAttribute(name);
                    }

                    protected Enumeration getAttributeNames() {
                        return page
                                .getAttributeNamesInScope(PageContext.PAGE_SCOPE);
                    }

                    protected Object getAttribute(String name) {
                        return page.getAttribute(name);
                    }
                };
            }
            return this.pageScope;
        }

        public Map getParam() {
            if (this.param == null) {
                this.param = new ScopeMap() {
                    protected Enumeration getAttributeNames() {
                        return page.getRequest().getParameterNames();
                    }

                    protected Object getAttribute(String name) {
                        return page.getRequest().getParameter(name);
                    }
                };
            }
            return this.param;
        }

        public Map getParamValues() {
            if (this.paramValues == null) {
                this.paramValues = new ScopeMap() {
                    protected Object getAttribute(String name) {
                        return page.getRequest().getParameterValues(name);
                    }

                    protected Enumeration getAttributeNames() {
                        return page.getRequest().getParameterNames();
                    }
                };
            }
            return this.paramValues;
        }

        public Map getRequestScope() {
            if (this.requestScope == null) {
                this.requestScope = new ScopeMap() {
                    protected void setAttribute(String name, Object value) {
                        page.getRequest().setAttribute(name, value);
                    }

                    protected void removeAttribute(String name) {
                        page.getRequest().removeAttribute(name);
                    }

                    protected Enumeration getAttributeNames() {
                        return page.getRequest().getAttributeNames();
                    }

                    protected Object getAttribute(String name) {
                        return page.getRequest().getAttribute(name);
                    }
                };
            }
            return this.requestScope;
        }

        public Map getSessionScope() {
            if (this.sessionScope == null) {
                this.sessionScope = new ScopeMap() {
                    protected void setAttribute(String name, Object value) {
                        ((HttpServletRequest) page.getRequest()).getSession()
                                .setAttribute(name, value);
                    }

                    protected void removeAttribute(String name) {
                        HttpSession session = page.getSession();
                        if (session != null) {
                            session.removeAttribute(name);
                        }
                    }

                    protected Enumeration getAttributeNames() {
                        HttpSession session = page.getSession();
                        if (session != null) {
                            return session.getAttributeNames();
                        }
                        return null;
                    }

                    protected Object getAttribute(String name) {
                        HttpSession session = page.getSession();
                        if (session != null) {
                            return session.getAttribute(name);
                        }
                        return null;
                    }
                };
            }
            return this.sessionScope;
        }
    }

    private abstract static class ScopeMap extends AbstractMap {

        protected abstract Enumeration getAttributeNames();

        protected abstract Object getAttribute(String name);

        protected void removeAttribute(String name) {
            throw new UnsupportedOperationException();
        }

        protected void setAttribute(String name, Object value) {
            throw new UnsupportedOperationException();
        }

        public final Set entrySet() {
            Enumeration e = getAttributeNames();
            Set set = new HashSet();
            if (e != null) {
                while (e.hasMoreElements()) {
                    set.add(new ScopeEntry((String) e.nextElement()));
                }
            }
            return set;
        }

        private class ScopeEntry implements Map.Entry {

            private final String key;

            public ScopeEntry(String key) {
                this.key = key;
            }

            public Object getKey() {
                return (Object) this.key;
            }

            public Object getValue() {
                return getAttribute(this.key);
            }

            public Object setValue(Object value) {
                if (value == null) {
                    removeAttribute(this.key);
                } else {
                    setAttribute(this.key, value);
                }
                return null;
            }

            public boolean equals(Object obj) {
                return (obj != null && this.hashCode() == obj.hashCode());
            }

            public int hashCode() {
                return this.key.hashCode();
            }

        }

        public final Object get(Object key) {
            if (key != null) {
                return getAttribute(key.toString());
            }
            return null;
        }

        public final Object put(Object key, Object value) {
            if (key == null) {
                throw new NullPointerException();
            }
            if (value == null) {
                this.removeAttribute(key.toString());
            } else {
                this.setAttribute(key.toString(), value);
            }
            return null;
        }

        public final Object remove(Object key) {
            if (key == null) {
                throw new NullPointerException();
            }
            this.removeAttribute(key.toString());
            return null;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



geronimo-jsp_2.2_spec/src/main/java/javax/servlet/jsp/el/ImplicitObjectELResolver.java [185:555]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            feat.setPreferred(true);
            feat.setValue(RESOLVABLE_AT_DESIGN_TIME, Boolean.TRUE);
            feat.setValue(TYPE, String.class);
            feats.add(feat);
        }
        return feats.iterator();
    }

    public Class<String> getCommonPropertyType(ELContext context, Object base) {
        if (base == null) {
            return String.class;
        }
        return null;
    }

    private static class ScopeManager {
        private final static String MNGR_KEY = ScopeManager.class.getName();

        private final PageContext page;

        private Map applicationScope;

        private Map cookie;

        private Map header;

        private Map headerValues;

        private Map initParam;

        private Map pageScope;

        private Map param;

        private Map paramValues;

        private Map requestScope;

        private Map sessionScope;

        public ScopeManager(PageContext page) {
            this.page = page;
        }

        public static ScopeManager get(PageContext page) {
            ScopeManager mngr = (ScopeManager) page.getAttribute(MNGR_KEY);
            if (mngr == null) {
                mngr = new ScopeManager(page);
                page.setAttribute(MNGR_KEY, mngr);
            }
            return mngr;
        }

        public Map getApplicationScope() {
            if (this.applicationScope == null) {
                this.applicationScope = new ScopeMap() {
                    protected void setAttribute(String name, Object value) {
                        page.getServletContext().setAttribute(name, value);
                    }

                    protected void removeAttribute(String name) {
                        page.getServletContext().removeAttribute(name);
                    }

                    protected Enumeration getAttributeNames() {
                        return page.getServletContext().getAttributeNames();
                    }

                    protected Object getAttribute(String name) {
                        return page.getServletContext().getAttribute(name);
                    }
                };
            }
            return this.applicationScope;
        }

        public Map getCookie() {
            if (this.cookie == null) {
                this.cookie = new ScopeMap() {
                    protected Enumeration getAttributeNames() {
                        Cookie[] c = ((HttpServletRequest) page.getRequest())
                                .getCookies();
                        if (c != null) {
                            Vector v = new Vector();
                            for (int i = 0; i < c.length; i++) {
                                v.add(c[i].getName());
                            }
                            return v.elements();
                        }
                        return null;
                    }

                    protected Object getAttribute(String name) {
                        Cookie[] c = ((HttpServletRequest) page.getRequest())
                                .getCookies();
                        if (c != null) {
                            for (int i = 0; i < c.length; i++) {
                                if (name.equals(c[i].getName())) {
                                    return c[i];
                                }
                            }
                        }
                        return null;
                    }

                };
            }
            return this.cookie;
        }

        public Map getHeader() {
            if (this.header == null) {
                this.header = new ScopeMap() {
                    protected Enumeration getAttributeNames() {
                        return ((HttpServletRequest) page.getRequest())
                                .getHeaderNames();
                    }

                    protected Object getAttribute(String name) {
                        return ((HttpServletRequest) page.getRequest())
                                .getHeader(name);
                    }
                };
            }
            return this.header;
        }

        public Map getHeaderValues() {
            if (this.headerValues == null) {
                this.headerValues = new ScopeMap() {
                    protected Enumeration getAttributeNames() {
                        return ((HttpServletRequest) page.getRequest())
                                .getHeaderNames();
                    }

                    protected Object getAttribute(String name) {
                        Enumeration e = ((HttpServletRequest) page.getRequest())
                                .getHeaders(name);
                        if (e != null) {
                            List list = new ArrayList();
                            while (e.hasMoreElements()) {
                                list.add(e.nextElement().toString());
                            }
                            return (String[]) list.toArray(new String[list
                                    .size()]);
                        }
                        return null;
                    }

                };
            }
            return this.headerValues;
        }

        public Map getInitParam() {
            if (this.initParam == null) {
                this.initParam = new ScopeMap() {
                    protected Enumeration getAttributeNames() {
                        return page.getServletContext().getInitParameterNames();
                    }

                    protected Object getAttribute(String name) {
                        return page.getServletContext().getInitParameter(name);
                    }
                };
            }
            return this.initParam;
        }

        public PageContext getPageContext() {
            return this.page;
        }

        public Map getPageScope() {
            if (this.pageScope == null) {
                this.pageScope = new ScopeMap() {
                    protected void setAttribute(String name, Object value) {
                        page.setAttribute(name, value);
                    }

                    protected void removeAttribute(String name) {
                        page.removeAttribute(name);
                    }

                    protected Enumeration getAttributeNames() {
                        return page
                                .getAttributeNamesInScope(PageContext.PAGE_SCOPE);
                    }

                    protected Object getAttribute(String name) {
                        return page.getAttribute(name);
                    }
                };
            }
            return this.pageScope;
        }

        public Map getParam() {
            if (this.param == null) {
                this.param = new ScopeMap() {
                    protected Enumeration getAttributeNames() {
                        return page.getRequest().getParameterNames();
                    }

                    protected Object getAttribute(String name) {
                        return page.getRequest().getParameter(name);
                    }
                };
            }
            return this.param;
        }

        public Map getParamValues() {
            if (this.paramValues == null) {
                this.paramValues = new ScopeMap() {
                    protected Object getAttribute(String name) {
                        return page.getRequest().getParameterValues(name);
                    }

                    protected Enumeration getAttributeNames() {
                        return page.getRequest().getParameterNames();
                    }
                };
            }
            return this.paramValues;
        }

        public Map getRequestScope() {
            if (this.requestScope == null) {
                this.requestScope = new ScopeMap() {
                    protected void setAttribute(String name, Object value) {
                        page.getRequest().setAttribute(name, value);
                    }

                    protected void removeAttribute(String name) {
                        page.getRequest().removeAttribute(name);
                    }

                    protected Enumeration getAttributeNames() {
                        return page.getRequest().getAttributeNames();
                    }

                    protected Object getAttribute(String name) {
                        return page.getRequest().getAttribute(name);
                    }
                };
            }
            return this.requestScope;
        }

        public Map getSessionScope() {
            if (this.sessionScope == null) {
                this.sessionScope = new ScopeMap() {
                    protected void setAttribute(String name, Object value) {
                        ((HttpServletRequest) page.getRequest()).getSession()
                                .setAttribute(name, value);
                    }

                    protected void removeAttribute(String name) {
                        HttpSession session = page.getSession();
                        if (session != null) {
                            session.removeAttribute(name);
                        }
                    }

                    protected Enumeration getAttributeNames() {
                        HttpSession session = page.getSession();
                        if (session != null) {
                            return session.getAttributeNames();
                        }
                        return null;
                    }

                    protected Object getAttribute(String name) {
                        HttpSession session = page.getSession();
                        if (session != null) {
                            return session.getAttribute(name);
                        }
                        return null;
                    }
                };
            }
            return this.sessionScope;
        }
    }

    private abstract static class ScopeMap extends AbstractMap {

        protected abstract Enumeration getAttributeNames();

        protected abstract Object getAttribute(String name);

        protected void removeAttribute(String name) {
            throw new UnsupportedOperationException();
        }

        protected void setAttribute(String name, Object value) {
            throw new UnsupportedOperationException();
        }

        public final Set entrySet() {
            Enumeration e = getAttributeNames();
            Set set = new HashSet();
            if (e != null) {
                while (e.hasMoreElements()) {
                    set.add(new ScopeEntry((String) e.nextElement()));
                }
            }
            return set;
        }

        private class ScopeEntry implements Map.Entry {

            private final String key;

            public ScopeEntry(String key) {
                this.key = key;
            }

            public Object getKey() {
                return (Object) this.key;
            }

            public Object getValue() {
                return getAttribute(this.key);
            }

            public Object setValue(Object value) {
                if (value == null) {
                    removeAttribute(this.key);
                } else {
                    setAttribute(this.key, value);
                }
                return null;
            }

            public boolean equals(Object obj) {
                return (obj != null && this.hashCode() == obj.hashCode());
            }

            public int hashCode() {
                return this.key.hashCode();
            }

        }

        public final Object get(Object key) {
            if (key != null) {
                return getAttribute(key.toString());
            }
            return null;
        }

        public final Object put(Object key, Object value) {
            if (key == null) {
                throw new NullPointerException();
            }
            if (value == null) {
                this.removeAttribute(key.toString());
            } else {
                this.setAttribute(key.toString(), value);
            }
            return null;
        }

        public final Object remove(Object key) {
            if (key == null) {
                throw new NullPointerException();
            }
            this.removeAttribute(key.toString());
            return null;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



