tiles-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r935400 [1/2] - in /tiles/sandbox/trunk/tiles-request: tiles-request-api/src/main/java/org/apache/tiles/request/collection/ tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/ tiles-request-api/src/main/java/org/a...
Date Sun, 18 Apr 2010 20:18:26 GMT
Author: apetrelli
Date: Sun Apr 18 20:18:25 2010
New Revision: 935400

URL: http://svn.apache.org/viewvc?rev=935400&view=rev
Log:
TILESSB-31
Refactored Servlet request support.

Added:
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AbstractEnumerationMap.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AddableParameterMap.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/HeaderValuesMap.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/KeySet.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/ParameterMap.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/RemovableKeySet.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/ScopeMap.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/AttributeExtractor.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasAddableKeys.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasKeys.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasRemovableKeys.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HeaderExtractor.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/util/RequestUtil.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ApplicationScopeExtractor.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/InitParameterExtractor.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ParameterExtractor.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/RequestScopeExtractor.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ServletHeaderExtractor.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/SessionScopeExtractor.java   (with props)
Removed:
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/ServletApplicationScopeMap.java
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/ServletHeaderMap.java
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/ServletHeaderValuesMap.java
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/ServletInitParamMap.java
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/ServletParamMap.java
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/ServletParamValuesMap.java
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/ServletRequestScopeMap.java
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/ServletSessionScopeMap.java
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/test/java/org/apache/tiles/request/servlet/ServletSessionScopeMapTest.java
Modified:
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet-wildcard/src/main/java/org/apache/tiles/request/servlet/wildcard/WildcardServletApplicationContext.java
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/ServletApplicationContext.java
    tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/ServletRequest.java

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AbstractEnumerationMap.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AbstractEnumerationMap.java?rev=935400&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AbstractEnumerationMap.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AbstractEnumerationMap.java Sun Apr 18 20:18:25 2010
@@ -0,0 +1,45 @@
+package org.apache.tiles.request.collection;
+
+import java.util.Enumeration;
+import java.util.Map;
+
+import org.apache.tiles.request.collection.extractor.HasKeys;
+
+public abstract class AbstractEnumerationMap<V> implements Map<String, V>{
+
+    protected HasKeys<V> request;
+
+    public AbstractEnumerationMap(HasKeys<V> request) {
+        this.request = request;
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override
+    public boolean equals(Object o) {
+        HasKeys<V> otherRequest = ((AbstractEnumerationMap<V>) o).request;
+        boolean retValue = true;
+        for (Enumeration<String> attribs = request.getKeys(); attribs
+                .hasMoreElements()
+                && retValue;) {
+            String parameterName = attribs.nextElement();
+            retValue = request.getValue(parameterName).equals(
+                    otherRequest.getValue(parameterName));
+        }
+
+        return retValue;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public int hashCode() {
+        int retValue = 0;
+        for (Enumeration<String> attribs = request.getKeys(); attribs
+                .hasMoreElements();) {
+            String parameterName = attribs.nextElement();
+            V value = request.getValue(parameterName);
+            retValue += parameterName.hashCode() ^ (value == null ? 0 : value.hashCode());
+        }
+        return retValue;
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AbstractEnumerationMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AbstractEnumerationMap.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AddableParameterMap.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AddableParameterMap.java?rev=935400&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AddableParameterMap.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AddableParameterMap.java Sun Apr 18 20:18:25 2010
@@ -0,0 +1,110 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tiles.request.collection;
+
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tiles.request.collection.extractor.HeaderExtractor;
+
+/**
+ * <p>Private implementation of <code>Map</code> for servlet request
+ * name-value.</p>
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class AddableParameterMap extends ParameterMap {
+
+    private HeaderExtractor request;
+
+    /**
+     * Constructor.
+     *
+     * @param request The request object to use.
+     * @param response The response object to use.
+     * @since 2.2.0
+     */
+    public AddableParameterMap(HeaderExtractor request) {
+        super(request);
+        this.request = request;
+    }
+
+    /** {@inheritDoc} */
+    public Set<Map.Entry<String, String>> entrySet() {
+        return new HeaderEntrySet();
+    }
+
+
+    /** {@inheritDoc} */
+    @Override
+    public boolean equals(Object o) {
+        HeaderExtractor otherRequest = ((AddableParameterMap) o).request;
+        boolean retValue = true;
+        synchronized (request) {
+            for (Enumeration<String> attribs = request.getKeys(); attribs
+                    .hasMoreElements()
+                    && retValue;) {
+                String parameterName = attribs.nextElement();
+                retValue = request.getValue(parameterName).equals(
+                        otherRequest.getValue(parameterName));
+            }
+        }
+
+        return retValue;
+    }
+
+    /** {@inheritDoc} */
+    public String put(String key, String value) {
+        request.setValue(key, value);
+        return value;
+    }
+
+
+    /** {@inheritDoc} */
+    public void putAll(Map<? extends String, ? extends String> map) {
+        for (Map.Entry<? extends String, ? extends String> entry : map
+                .entrySet()) {
+            request.setValue(entry.getKey(), entry.getValue());
+        }
+    }
+
+
+    private class HeaderEntrySet extends ParameterMap.HeaderEntrySet {
+
+        @Override
+        public boolean add(java.util.Map.Entry<String, String> e) {
+            request.setValue(e.getKey(), e.getValue());
+            return true;
+        }
+
+        @Override
+        public boolean addAll(
+                Collection<? extends java.util.Map.Entry<String, String>> c) {
+            for (Map.Entry<String, String> entry : c) {
+                request.setValue(entry.getKey(), entry.getValue());
+            }
+            return true;
+        }
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AddableParameterMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AddableParameterMap.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/HeaderValuesMap.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/HeaderValuesMap.java?rev=935400&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/HeaderValuesMap.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/HeaderValuesMap.java Sun Apr 18 20:18:25 2010
@@ -0,0 +1,463 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tiles.request.collection;
+
+import static org.apache.tiles.request.util.RequestUtil.*;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tiles.request.collection.extractor.HeaderExtractor;
+import org.apache.tiles.request.util.MapEntry;
+
+
+/**
+ * <p>Private implementation of <code>Map</code> for servlet request
+ * name-values[].</p>
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class HeaderValuesMap implements Map<String, String[]> {
+
+    private HeaderExtractor request;
+
+    /**
+     * Constructor.
+     *
+     * @param request The request object to use.
+     */
+    public HeaderValuesMap(HeaderExtractor request) {
+        this.request = request;
+    }
+
+
+    /** {@inheritDoc} */
+    public void clear() {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /** {@inheritDoc} */
+    public boolean containsKey(Object key) {
+        return (request.getValue(key(key)) != null);
+    }
+
+
+    /** {@inheritDoc} */
+    public boolean containsValue(Object value) {
+        if (!(value instanceof String[])) {
+            return (false);
+        }
+        String[] test = (String[]) value;
+        Enumeration<String> names = request.getKeys();
+        while (names.hasMoreElements()) {
+            String name = names.nextElement();
+            if (compareHeaders(name, array2set(test))) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+
+    /** {@inheritDoc} */
+    public Set<Map.Entry<String, String[]>> entrySet() {
+        return new HeadersEntrySet();
+    }
+
+
+    /** {@inheritDoc} */
+    @Override
+    public boolean equals(Object o) {
+        HeaderExtractor otherRequest = ((HeaderValuesMap) o).request;
+        boolean retValue = true;
+        for (Enumeration<String> attribs = request.getKeys(); attribs
+                .hasMoreElements()
+                && retValue;) {
+            String parameterName = attribs.nextElement();
+            Set<String> valueSet = enumeration2set(otherRequest.getValues(parameterName));
+            retValue = compareHeaders(parameterName, valueSet);
+        }
+
+        return retValue;
+    }
+
+
+    /** {@inheritDoc} */
+    public String[] get(Object key) {
+        return getHeaderValues(key(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public int hashCode() {
+        int retValue = 0;
+        for (Enumeration<String> attribs = request.getKeys(); attribs
+                .hasMoreElements();) {
+            String parameterName = attribs.nextElement();
+            Enumeration<String> values = request.getValues(parameterName);
+            int valueHash = 0;
+            while (values.hasMoreElements()) {
+                valueHash += values.nextElement().hashCode();
+            }
+            retValue += parameterName.hashCode() ^ valueHash;
+        }
+        return retValue;
+    }
+
+
+    /** {@inheritDoc} */
+    public boolean isEmpty() {
+        return !request.getKeys().hasMoreElements();
+    }
+
+
+    /** {@inheritDoc} */
+    public Set<String> keySet() {
+        return new KeySet(request);
+    }
+
+
+    /** {@inheritDoc} */
+    public String[] put(String key, String[] value) {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /** {@inheritDoc} */
+    public void putAll(Map<? extends String, ? extends String[]> map) {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /** {@inheritDoc} */
+    public String[] remove(Object key) {
+        throw new UnsupportedOperationException();
+    }
+
+
+
+    /** {@inheritDoc} */
+    public int size() {
+        return enumerationSize(request.getKeys());
+    }
+
+
+    /** {@inheritDoc} */
+    public Collection<String[]> values() {
+        return new HeaderValuesCollection();
+    }
+
+    private String[] getHeaderValues(String key) {
+        List<String> list = new ArrayList<String>();
+        Enumeration<String> values = request.getValues(key);
+        while (values.hasMoreElements()) {
+            list.add(values.nextElement());
+        }
+        String[] retValue = list.toArray(new String[list.size()]);
+        return retValue;
+    }
+
+    /**
+     * Converts the content of a string enumeration to an array of strings.
+     *
+     * @param enumeration The enumeration to convert.
+     * @return The corresponding array.
+     */
+    private String[] enumeration2array(Enumeration<String> enumeration) {
+        List<String> list1 = new ArrayList<String>();
+        while (enumeration.hasMoreElements()) {
+            list1.add(enumeration.nextElement());
+        }
+
+        return list1.toArray(new String[list1.size()]);
+    }
+
+    /**
+     * Converts the content of a string enumeration to an array of strings.
+     *
+     * @param enumeration The enumeration to convert.
+     * @return The corresponding array.
+     */
+    private Set<String> enumeration2set(Enumeration<String> enumeration) {
+        Set<String> retValue = new HashSet<String>();
+        while (enumeration.hasMoreElements()) {
+            retValue.add(enumeration.nextElement());
+        }
+        return retValue;
+    }
+
+    private Set<String> array2set(String[] valueArray) {
+        Set<String> values = new HashSet<String>();
+        for (int i = 0; i < valueArray.length; i++) {
+            values.add(valueArray[i]);
+        }
+        return values;
+    }
+
+    private boolean compareHeaders(String name, Set<String> testSet) {
+        Enumeration<String> values = request.getValues(name);
+        boolean matched = true;
+        while (values.hasMoreElements() && matched) {
+            String currentValue = values.nextElement();
+            matched = testSet.remove(currentValue);
+        }
+        matched = matched && testSet.isEmpty();
+        return matched;
+    }
+
+    private class HeadersEntrySet implements Set<Map.Entry<String, String[]>> {
+
+        @Override
+        public boolean add(java.util.Map.Entry<String, String[]> e) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean addAll(
+                Collection<? extends java.util.Map.Entry<String, String[]>> c) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void clear() {
+            throw new UnsupportedOperationException();
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public boolean contains(Object o) {
+            return containsEntry((java.util.Map.Entry<String, String[]>) o);
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public boolean containsAll(Collection<?> c) {
+            Collection<Map.Entry<String, String[]>> realCollection =
+                (Collection<Map.Entry<String, String[]>>) c;
+            for (Map.Entry<String, String[]> entry : realCollection) {
+                if (!containsEntry(entry)) {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        @Override
+        public boolean isEmpty() {
+            return HeaderValuesMap.this.isEmpty();
+        }
+
+        @Override
+        public Iterator<java.util.Map.Entry<String, String[]>> iterator() {
+            return new HeadersEntrySetIterator();
+        }
+
+        @Override
+        public boolean remove(Object o) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean removeAll(Collection<?> c) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean retainAll(Collection<?> c) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public int size() {
+            return HeaderValuesMap.this.size();
+        }
+
+        @Override
+        public Object[] toArray() {
+            return toList().toArray();
+        }
+
+        @Override
+        public <T> T[] toArray(T[] a) {
+            return toList().toArray(a);
+        }
+
+        private boolean containsEntry(Map.Entry<String, String[]> entry) {
+            Enumeration<String> entryValues = request.getValues(key(entry.getKey()));
+            String[] valueArray = entry.getValue();
+            Set<String> values = array2set(valueArray);
+            while (entryValues.hasMoreElements()) {
+                if (!values.remove(entryValues.nextElement())) {
+                    return false;
+                }
+            }
+            return values.isEmpty();
+        }
+
+        private List<Map.Entry<String, String[]>> toList() {
+            List<Map.Entry<String, String[]>> entries = new ArrayList<Map.Entry<String,String[]>>();
+            Enumeration<String> names = request.getKeys();
+            while (names.hasMoreElements()) {
+                entries.add(extractNextEntry(names));
+            }
+            return entries;
+        }
+
+        private MapEntry<String, String[]> extractNextEntry(
+                Enumeration<String> names) {
+            String name = names.nextElement();
+            return new MapEntry<String, String[]>(name, getHeaderValues(name), false);
+        }
+
+        private class HeadersEntrySetIterator implements Iterator<Map.Entry<String, String[]>> {
+
+            private Enumeration<String> namesEnumeration = request.getKeys();
+
+            @Override
+            public boolean hasNext() {
+                return namesEnumeration.hasMoreElements();
+            }
+
+            @Override
+            public Map.Entry<String, String[]> next() {
+                return extractNextEntry(namesEnumeration);
+            }
+
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+
+        }
+    }
+
+    private class HeaderValuesCollection implements Collection<String[]> {
+
+        @Override
+        public boolean add(String[] e) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean addAll(Collection<? extends String[]> c) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void clear() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean contains(Object o) {
+            return containsValue(o);
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public boolean containsAll(Collection<?> c) {
+            Collection<String[]> realCollection = (Collection<String[]>) c;
+            for (String[] value : realCollection) {
+                if (!containsValue(value)) {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        @Override
+        public boolean isEmpty() {
+            return HeaderValuesMap.this.isEmpty();
+        }
+
+        @Override
+        public Iterator<String[]> iterator() {
+            return new HeaderValuesCollectionIterator();
+        }
+
+        @Override
+        public boolean remove(Object o) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean removeAll(Collection<?> c) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean retainAll(Collection<?> c) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public int size() {
+            return HeaderValuesMap.this.size();
+        }
+
+        @Override
+        public Object[] toArray() {
+            return toList().toArray();
+        }
+
+        @Override
+        public <T> T[] toArray(T[] a) {
+            return toList().toArray(a);
+        }
+
+        private List<String[]> toList() {
+            List<String[]> entries = new ArrayList<String[]>();
+            Enumeration<String> names = request.getKeys();
+            while (names.hasMoreElements()) {
+                entries.add(enumeration2array(request.getValues(names.nextElement())));
+            }
+            return entries;
+        }
+
+        private class HeaderValuesCollectionIterator implements Iterator<String[]> {
+
+            private Enumeration<String> namesEnumeration = request.getKeys();
+
+            @Override
+            public boolean hasNext() {
+                return namesEnumeration.hasMoreElements();
+            }
+
+            @Override
+            public String[] next() {
+                return enumeration2array(request.getValues(namesEnumeration.nextElement()));
+            }
+
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+        }
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/HeaderValuesMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/HeaderValuesMap.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/KeySet.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/KeySet.java?rev=935400&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/KeySet.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/KeySet.java Sun Apr 18 20:18:25 2010
@@ -0,0 +1,122 @@
+package org.apache.tiles.request.collection;
+
+import static org.apache.tiles.request.util.RequestUtil.*;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tiles.request.collection.extractor.HasKeys;
+
+public class KeySet implements Set<String> {
+
+    private HasKeys<?> request;
+
+    public KeySet(HasKeys<?> request) {
+        this.request = request;
+    }
+
+    @Override
+    public boolean add(String e) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean addAll(Collection<? extends String> c) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void clear() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean contains(Object o) {
+        return request.getValue(key(o)) != null;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public boolean containsAll(Collection<?> c) {
+        Collection<String> realCollection = (Collection<String>) c;
+        for (String key : realCollection) {
+            if (request.getValue(key(key)) == null) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return !request.getKeys().hasMoreElements();
+    }
+
+    @Override
+    public Iterator<String> iterator() {
+        return new ServletHeaderKeySetIterator();
+    }
+
+    @Override
+    public boolean remove(Object o) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean removeAll(Collection<?> c) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean retainAll(Collection<?> c) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int size() {
+        return enumerationSize(request.getKeys());
+    }
+
+    @Override
+    public Object[] toArray() {
+        return toList().toArray();
+    }
+
+    @Override
+    public <T> T[] toArray(T[] a) {
+        return toList().toArray(a);
+    }
+
+    private List<String> toList() {
+        List<String> entries = new ArrayList<String>();
+        Enumeration<String> names = request.getKeys();
+        while (names.hasMoreElements()) {
+            entries.add(names.nextElement());
+        }
+        return entries;
+    }
+
+    private class ServletHeaderKeySetIterator implements Iterator<String> {
+
+        private Enumeration<String> namesEnumeration = request.getKeys();
+
+        @Override
+        public boolean hasNext() {
+            return namesEnumeration.hasMoreElements();
+        }
+
+        @Override
+        public String next() {
+            return namesEnumeration.nextElement();
+        }
+
+        @Override
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/KeySet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/KeySet.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/ParameterMap.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/ParameterMap.java?rev=935400&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/ParameterMap.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/ParameterMap.java Sun Apr 18 20:18:25 2010
@@ -0,0 +1,358 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tiles.request.collection;
+
+import static org.apache.tiles.request.util.RequestUtil.*;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tiles.request.collection.extractor.HasKeys;
+import org.apache.tiles.request.util.MapEntry;
+
+/**
+ * <p>Private implementation of <code>Map</code> for servlet request
+ * name-value.</p>
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class ParameterMap extends AbstractEnumerationMap<String> {
+
+    /**
+     * Constructor.
+     *
+     * @param request The request object to use.
+     * @param response The response object to use.
+     * @since 2.2.0
+     */
+    public ParameterMap(HasKeys<String> request) {
+        super(request);
+    }
+
+    /** {@inheritDoc} */
+    public void clear() {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /** {@inheritDoc} */
+    public boolean containsKey(Object key) {
+        return (request.getValue(key(key)) != null);
+    }
+
+
+    /** {@inheritDoc} */
+    public boolean containsValue(Object value) {
+        Iterator<String> values = values().iterator();
+        while (values.hasNext()) {
+            if (value.equals(values.next())) {
+                return (true);
+            }
+        }
+        return (false);
+    }
+
+
+    /** {@inheritDoc} */
+    public Set<Map.Entry<String, String>> entrySet() {
+        return new HeaderEntrySet();
+    }
+
+
+    /** {@inheritDoc} */
+    public String get(Object key) {
+        return (request.getValue(key(key)));
+    }
+
+
+    /** {@inheritDoc} */
+    public boolean isEmpty() {
+        return !request.getKeys().hasMoreElements();
+    }
+
+
+    /** {@inheritDoc} */
+    public Set<String> keySet() {
+        return new KeySet(request);
+    }
+
+
+    /** {@inheritDoc} */
+    public String put(String key, String value) {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /** {@inheritDoc} */
+    public void putAll(Map<? extends String, ? extends String> map) {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /** {@inheritDoc} */
+    public String remove(Object key) {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /** {@inheritDoc} */
+    public int size() {
+        return enumerationSize(request.getKeys());
+    }
+
+
+    /** {@inheritDoc} */
+    public Collection<String> values() {
+        return new HeaderValuesCollection();
+    }
+
+
+    class HeaderEntrySet implements Set<Map.Entry<String, String>> {
+
+        @Override
+        public boolean add(java.util.Map.Entry<String, String> e) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean addAll(
+                Collection<? extends java.util.Map.Entry<String, String>> c) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void clear() {
+            throw new UnsupportedOperationException();
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public boolean contains(Object o) {
+            return containsEntry((java.util.Map.Entry<String, String>) o);
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public boolean containsAll(Collection<?> c) {
+            Collection<Map.Entry<String, String>> realCollection =
+                (Collection<Map.Entry<String, String>>) c;
+            for (Map.Entry<String, String> entry : realCollection) {
+                if (!containsEntry(entry)) {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        @Override
+        public boolean isEmpty() {
+            return ParameterMap.this.isEmpty();
+        }
+
+        @Override
+        public Iterator<java.util.Map.Entry<String, String>> iterator() {
+            return new HeaderEntrySetIterator();
+        }
+
+        @Override
+        public boolean remove(Object o) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean removeAll(Collection<?> c) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean retainAll(Collection<?> c) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public int size() {
+            return ParameterMap.this.size();
+        }
+
+        @Override
+        public Object[] toArray() {
+            return toList().toArray();
+        }
+
+        @Override
+        public <T> T[] toArray(T[] a) {
+            return toList().toArray(a);
+        }
+
+        private boolean containsEntry(Map.Entry<String, String> entry) {
+            String storedValue = request.getValue(key(entry.getKey()));
+            return storedValue != null && storedValue.equals(entry.getValue());
+        }
+
+        private List<Map.Entry<String, String>> toList() {
+            List<Map.Entry<String, String>> entries = new ArrayList<Map.Entry<String,String>>();
+            Enumeration<String> names = request.getKeys();
+            while (names.hasMoreElements()) {
+                entries.add(extractNextEntry(names));
+            }
+            return entries;
+        }
+
+        private MapEntry<String, String> extractNextEntry(
+                Enumeration<String> names) {
+            String name = names.nextElement();
+            return new MapEntry<String, String>(name, request.getValue(name),
+                    false);
+        }
+
+        private class HeaderEntrySetIterator implements Iterator<Map.Entry<String, String>> {
+
+            private Enumeration<String> namesEnumeration = request.getKeys();
+
+            @Override
+            public boolean hasNext() {
+                return namesEnumeration.hasMoreElements();
+            }
+
+            @Override
+            public java.util.Map.Entry<String, String> next() {
+                return extractNextEntry(namesEnumeration);
+            }
+
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+
+        }
+    }
+
+    private class HeaderValuesCollection implements Collection<String> {
+
+        @Override
+        public boolean add(String e) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean addAll(Collection<? extends String> c) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void clear() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean contains(Object o) {
+            return containsValue(o);
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public boolean containsAll(Collection<?> c) {
+            Collection<String> realCollection = (Collection<String>) c;
+            for (String value : realCollection) {
+                if (!containsValue(value)) {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        @Override
+        public boolean isEmpty() {
+            return ParameterMap.this.isEmpty();
+        }
+
+        @Override
+        public Iterator<String> iterator() {
+            return new HeaderValuesCollectionIterator();
+        }
+
+        @Override
+        public boolean remove(Object o) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean removeAll(Collection<?> c) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean retainAll(Collection<?> c) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public int size() {
+            return ParameterMap.this.size();
+        }
+
+        @Override
+        public Object[] toArray() {
+            return toList().toArray();
+        }
+
+        @Override
+        public <T> T[] toArray(T[] a) {
+            return toList().toArray(a);
+        }
+
+        private List<String> toList() {
+            List<String> entries = new ArrayList<String>();
+            Enumeration<String> names = request.getKeys();
+            while (names.hasMoreElements()) {
+                entries.add(request.getValue(names.nextElement()));
+            }
+            return entries;
+        }
+
+
+        private class HeaderValuesCollectionIterator implements Iterator<String> {
+
+            private Enumeration<String> namesEnumeration = request.getKeys();
+
+            @Override
+            public boolean hasNext() {
+                return namesEnumeration.hasMoreElements();
+            }
+
+            @Override
+            public String next() {
+                return request.getValue(namesEnumeration.nextElement());
+            }
+
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+        }
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/ParameterMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/ParameterMap.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/RemovableKeySet.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/RemovableKeySet.java?rev=935400&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/RemovableKeySet.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/RemovableKeySet.java Sun Apr 18 20:18:25 2010
@@ -0,0 +1,52 @@
+package org.apache.tiles.request.collection;
+
+import static org.apache.tiles.request.util.RequestUtil.*;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.tiles.request.collection.extractor.HasRemovableKeys;
+
+public class RemovableKeySet extends KeySet {
+
+    private HasRemovableKeys<?> request;
+
+    public RemovableKeySet(HasRemovableKeys<?> request) {
+        super(request);
+        this.request = request;
+    }
+
+    @Override
+    public boolean remove(Object o) {
+        String skey = key(o);
+        Object previous = request.getValue(skey);
+        if (previous != null) {
+            request.removeValue(skey);
+            return true;
+        }
+        return false;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public boolean removeAll(Collection<?> c) {
+        Collection<Map.Entry<String, Object>> realCollection = (Collection<java.util.Map.Entry<String, Object>>) c;
+        boolean retValue = false;
+        for (Map.Entry<String, Object> entry : realCollection) {
+            retValue |= remove(entry);
+        }
+        return retValue;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public boolean retainAll(Collection<?> c) {
+        Collection<String> realCollection = (Collection<String>) c;
+        boolean retValue = false;
+        for (String key : realCollection) {
+            retValue |= remove(key);
+        }
+        return retValue;
+    }
+
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/RemovableKeySet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/RemovableKeySet.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/ScopeMap.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/ScopeMap.java?rev=935400&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/ScopeMap.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/ScopeMap.java Sun Apr 18 20:18:25 2010
@@ -0,0 +1,405 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tiles.request.collection;
+
+import static org.apache.tiles.request.util.RequestUtil.*;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tiles.request.collection.extractor.AttributeExtractor;
+import org.apache.tiles.request.util.MapEntry;
+
+/**
+ * <p>Private implementation of <code>Map</code> for servlet context
+ * attributes.</p>
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class ScopeMap extends AbstractEnumerationMap<Object> {
+
+    private AttributeExtractor context;
+
+    /**
+     * Constructor.
+     *
+     * @param context The servlet context to use.
+     */
+    public ScopeMap(AttributeExtractor context) {
+        super(context);
+        this.context = context;
+    }
+
+
+    /** {@inheritDoc} */
+    public void clear() {
+        Enumeration<String> keys = context.getKeys();
+        while (keys.hasMoreElements()) {
+            context.removeValue(keys.nextElement());
+        }
+    }
+
+
+    /** {@inheritDoc} */
+    public boolean containsKey(Object key) {
+        return context.getValue(key(key)) != null;
+    }
+
+
+    /** {@inheritDoc} */
+    public boolean containsValue(Object value) {
+        if (value == null) {
+            return (false);
+        }
+        Enumeration<String> keys = context.getKeys();
+        while (keys.hasMoreElements()) {
+            Object next = context.getValue(keys.nextElement());
+            if (next == value) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+
+    /** {@inheritDoc} */
+    public Set<Map.Entry<String, Object>> entrySet() {
+        return new ServletApplicationScopeEntrySet();
+    }
+
+
+
+    /** {@inheritDoc} */
+    public Object get(Object key) {
+        return context.getValue(key(key));
+    }
+
+    /** {@inheritDoc} */
+    public boolean isEmpty() {
+        return !context.getKeys().hasMoreElements();
+    }
+
+
+    /** {@inheritDoc} */
+    public Set<String> keySet() {
+        return new RemovableKeySet(context);
+    }
+
+
+    /** {@inheritDoc} */
+    public Object put(String key, Object value) {
+        if (value == null) {
+            return remove(key);
+        }
+        String skey = key(key);
+        Object previous = context.getValue(skey);
+        context.setValue(skey, value);
+        return previous;
+    }
+
+
+    /** {@inheritDoc} */
+    public void putAll(Map<? extends String, ? extends Object> map) {
+        Iterator<? extends String> keys = map.keySet().iterator();
+        while (keys.hasNext()) {
+            String key = keys.next();
+            context.setValue(key, map.get(key));
+        }
+    }
+
+
+    /** {@inheritDoc} */
+    public Object remove(Object key) {
+        String skey = key(key);
+        Object previous = context.getValue(skey);
+        context.removeValue(skey);
+        return (previous);
+    }
+
+
+    /** {@inheritDoc} */
+    public int size() {
+        return enumerationSize(context.getKeys());
+    }
+
+
+    /** {@inheritDoc} */
+    public Collection<Object> values() {
+        return new ServletApplicationScopeValuesCollection();
+    }
+
+    private class ServletApplicationScopeEntrySet implements Set<Map.Entry<String, Object>> {
+
+        @Override
+        public boolean add(java.util.Map.Entry<String, Object> e) {
+            Object oldValue = get(e.getKey());
+            put(e.getKey(), e.getValue());
+            return oldValue == null || !oldValue.equals(e.getValue());
+        }
+
+        @Override
+        public boolean addAll(
+                Collection<? extends java.util.Map.Entry<String, Object>> c) {
+            boolean retValue = false;
+            for (Map.Entry<String, Object> entry : c) {
+                retValue |= add(entry);
+            }
+            return retValue;
+        }
+
+        @Override
+        public void clear() {
+            ScopeMap.this.clear();
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public boolean contains(Object o) {
+            return containsEntry((java.util.Map.Entry<String, Object>) o);
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public boolean containsAll(Collection<?> c) {
+            Collection<Map.Entry<String, Object>> realCollection =
+                (Collection<Map.Entry<String, Object>>) c;
+            for (Map.Entry<String, Object> entry : realCollection) {
+                if (!containsEntry(entry)) {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        @Override
+        public boolean isEmpty() {
+            return ScopeMap.this.isEmpty();
+        }
+
+        @Override
+        public Iterator<java.util.Map.Entry<String, Object>> iterator() {
+            return new ServletApplicationScopeEntrySetIterator();
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public boolean remove(Object o) {
+            Map.Entry<String, Object> entry = (java.util.Map.Entry<String, Object>) o;
+            Object currentValue = get(entry.getKey());
+            if (currentValue != null && currentValue.equals(entry.getValue())) {
+                context.removeValue(entry.getKey());
+                return true;
+            }
+            return false;
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public boolean removeAll(Collection<?> c) {
+            Collection<Map.Entry<String, Object>> realCollection = (Collection<java.util.Map.Entry<String, Object>>) c;
+            boolean retValue = false;
+            for (Map.Entry<String, Object> entry : realCollection) {
+                retValue |= remove(entry);
+            }
+            return retValue;
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public boolean retainAll(Collection<?> c) {
+            Collection<Map.Entry<String, Object>> realCollection = (Collection<java.util.Map.Entry<String, Object>>) c;
+            boolean retValue = false;
+            for (Map.Entry<String, Object> entry : realCollection) {
+                if (containsEntry(entry)) {
+                    retValue |= remove(entry);
+                }
+            }
+            return retValue;
+        }
+
+        @Override
+        public int size() {
+            return ScopeMap.this.size();
+        }
+
+        @Override
+        public Object[] toArray() {
+            return toList().toArray();
+        }
+
+        @Override
+        public <T> T[] toArray(T[] a) {
+            return toList().toArray(a);
+        }
+
+        private boolean containsEntry(Map.Entry<String, Object> entry) {
+            Object storedValue = context.getValue(key(entry.getKey()));
+            return storedValue != null && storedValue.equals(entry.getValue());
+        }
+
+        private List<Map.Entry<String, Object>> toList() {
+            List<Map.Entry<String, Object>> entries = new ArrayList<Map.Entry<String,Object>>();
+            Enumeration<String> names = context.getKeys();
+            while (names.hasMoreElements()) {
+                entries.add(extractNextEntry(names));
+            }
+            return entries;
+        }
+
+        private MapEntry<String, Object> extractNextEntry(
+                Enumeration<String> names) {
+            String name = names.nextElement();
+            return new MapEntry<String, Object>(name, context.getValue(name),
+                    false);
+        }
+
+        private class ServletApplicationScopeEntrySetIterator implements Iterator<Map.Entry<String, Object>> {
+
+            private Enumeration<String> namesEnumeration = context.getKeys();
+
+            @Override
+            public boolean hasNext() {
+                return namesEnumeration.hasMoreElements();
+            }
+
+            @Override
+            public java.util.Map.Entry<String, Object> next() {
+                return extractNextEntry(namesEnumeration);
+            }
+
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+
+        }
+    }
+
+    private class ServletApplicationScopeValuesCollection implements Collection<Object> {
+
+        @Override
+        public boolean add(Object e) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean addAll(Collection<? extends Object> c) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void clear() {
+            ScopeMap.this.clear();
+        }
+
+        @Override
+        public boolean contains(Object o) {
+            return containsValue(o);
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public boolean containsAll(Collection<?> c) {
+            Collection<String> realCollection = (Collection<String>) c;
+            for (String value : realCollection) {
+                if (!containsValue(value)) {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        @Override
+        public boolean isEmpty() {
+            return ScopeMap.this.isEmpty();
+        }
+
+        @Override
+        public Iterator<Object> iterator() {
+            return new ServletApplicationScopeValuesCollectionIterator();
+        }
+
+        @Override
+        public boolean remove(Object o) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean removeAll(Collection<?> c) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean retainAll(Collection<?> c) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public int size() {
+            return ScopeMap.this.size();
+        }
+
+        @Override
+        public Object[] toArray() {
+            return toList().toArray();
+        }
+
+        @Override
+        public <T> T[] toArray(T[] a) {
+            return toList().toArray(a);
+        }
+
+        private List<Object> toList() {
+            List<Object> entries = new ArrayList<Object>();
+            Enumeration<String> names = context.getKeys();
+            while (names.hasMoreElements()) {
+                entries.add(context.getValue(names.nextElement()));
+            }
+            return entries;
+        }
+
+        private class ServletApplicationScopeValuesCollectionIterator implements Iterator<Object> {
+
+            private Enumeration<String> namesEnumeration = context.getKeys();
+
+            @Override
+            public boolean hasNext() {
+                return namesEnumeration.hasMoreElements();
+            }
+
+            @Override
+            public Object next() {
+                return context.getValue(namesEnumeration.nextElement());
+            }
+
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+        }
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/ScopeMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/ScopeMap.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/AttributeExtractor.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/AttributeExtractor.java?rev=935400&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/AttributeExtractor.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/AttributeExtractor.java Sun Apr 18 20:18:25 2010
@@ -0,0 +1,4 @@
+package org.apache.tiles.request.collection.extractor;
+
+public interface AttributeExtractor extends HasRemovableKeys<Object>, HasAddableKeys<Object> {
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/AttributeExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/AttributeExtractor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasAddableKeys.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasAddableKeys.java?rev=935400&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasAddableKeys.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasAddableKeys.java Sun Apr 18 20:18:25 2010
@@ -0,0 +1,5 @@
+package org.apache.tiles.request.collection.extractor;
+
+public interface HasAddableKeys<V> extends HasKeys<V> {
+    void setValue(String key, V value);
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasAddableKeys.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasAddableKeys.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasKeys.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasKeys.java?rev=935400&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasKeys.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasKeys.java Sun Apr 18 20:18:25 2010
@@ -0,0 +1,10 @@
+package org.apache.tiles.request.collection.extractor;
+
+import java.util.Enumeration;
+
+public interface HasKeys<V> {
+
+    Enumeration<String> getKeys();
+
+    V getValue(String key);
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasKeys.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasKeys.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasRemovableKeys.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasRemovableKeys.java?rev=935400&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasRemovableKeys.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasRemovableKeys.java Sun Apr 18 20:18:25 2010
@@ -0,0 +1,5 @@
+package org.apache.tiles.request.collection.extractor;
+
+public interface HasRemovableKeys<V> extends HasKeys<V> {
+    void removeValue(String name);
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasRemovableKeys.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HasRemovableKeys.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HeaderExtractor.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HeaderExtractor.java?rev=935400&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HeaderExtractor.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HeaderExtractor.java Sun Apr 18 20:18:25 2010
@@ -0,0 +1,8 @@
+package org.apache.tiles.request.collection.extractor;
+
+import java.util.Enumeration;
+
+public interface HeaderExtractor extends HasAddableKeys<String> {
+
+    Enumeration<String> getValues(String key);
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HeaderExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/extractor/HeaderExtractor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/util/RequestUtil.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/util/RequestUtil.java?rev=935400&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/util/RequestUtil.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/util/RequestUtil.java Sun Apr 18 20:18:25 2010
@@ -0,0 +1,36 @@
+package org.apache.tiles.request.util;
+
+import java.util.Enumeration;
+
+public class RequestUtil {
+
+    private RequestUtil() {
+
+    }
+
+    /**
+     * Returns the string representation of the key.
+     *
+     * @param key The key.
+     * @return The string representation of the key.
+     * @throws IllegalArgumentException If the key is <code>null</code>.
+     */
+    public static String key(Object key) {
+        if (key == null) {
+            throw new IllegalArgumentException();
+        } else if (key instanceof String) {
+            return ((String) key);
+        } else {
+            return (key.toString());
+        }
+    }
+
+    public static int enumerationSize(Enumeration<?> keys) {
+        int n = 0;
+        while (keys.hasMoreElements()) {
+            keys.nextElement();
+            n++;
+        }
+        return n;
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/util/RequestUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/util/RequestUtil.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: tiles/sandbox/trunk/tiles-request/tiles-request-servlet-wildcard/src/main/java/org/apache/tiles/request/servlet/wildcard/WildcardServletApplicationContext.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-servlet-wildcard/src/main/java/org/apache/tiles/request/servlet/wildcard/WildcardServletApplicationContext.java?rev=935400&r1=935399&r2=935400&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-servlet-wildcard/src/main/java/org/apache/tiles/request/servlet/wildcard/WildcardServletApplicationContext.java (original)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-servlet-wildcard/src/main/java/org/apache/tiles/request/servlet/wildcard/WildcardServletApplicationContext.java Sun Apr 18 20:18:25 2010
@@ -58,14 +58,7 @@ public class WildcardServletApplicationC
      */
     public WildcardServletApplicationContext(ServletContext servletContext) {
         super(servletContext);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void initialize(ServletContext context) {
-        super.initialize(context);
-
-        resolver = new ServletContextResourcePatternResolver(context);
+        resolver = new ServletContextResourcePatternResolver(servletContext);
     }
 
     /** {@inheritDoc} */

Modified: tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/ServletApplicationContext.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/ServletApplicationContext.java?rev=935400&r1=935399&r2=935400&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/ServletApplicationContext.java (original)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/ServletApplicationContext.java Sun Apr 18 20:18:25 2010
@@ -29,6 +29,10 @@ import java.util.Set;
 import javax.servlet.ServletContext;
 
 import org.apache.tiles.request.ApplicationContext;
+import org.apache.tiles.request.collection.ParameterMap;
+import org.apache.tiles.request.collection.ScopeMap;
+import org.apache.tiles.request.servlet.extractor.ApplicationScopeExtractor;
+import org.apache.tiles.request.servlet.extractor.InitParameterExtractor;
 
 /**
  * Servlet-based implementation of the TilesApplicationContext interface.
@@ -63,7 +67,7 @@ public class ServletApplicationContext i
      * @param servletContext The servlet context to use.
      */
     public ServletApplicationContext(ServletContext servletContext) {
-        initialize(servletContext);
+        this.servletContext = servletContext;
     }
 
     /** {@inheritDoc} */
@@ -75,7 +79,7 @@ public class ServletApplicationContext i
     public Map<String, Object> getApplicationScope() {
 
         if ((applicationScope == null) && (servletContext != null)) {
-            applicationScope = new ServletApplicationScopeMap(servletContext);
+            applicationScope = new ScopeMap(new ApplicationScopeExtractor(servletContext));
         }
         return (applicationScope);
 
@@ -86,7 +90,7 @@ public class ServletApplicationContext i
     public Map<String, String> getInitParams() {
 
         if ((initParam == null) && (servletContext != null)) {
-            initParam = new ServletInitParamMap(servletContext);
+            initParam = new ParameterMap(new InitParameterExtractor(servletContext));
         }
         return (initParam);
 
@@ -103,35 +107,4 @@ public class ServletApplicationContext i
         urls.add(getResource(path));
         return urls;
     }
-
-    /**
-     * <p>Initialize (or reinitialize) this {@link ApplicationContext} instance
-     * for the specified Servlet API objects.</p>
-     *
-     * @param context The <code>ServletContext</code> for this web application
-     */
-    public void initialize(ServletContext context) {
-        // Save the specified Servlet API object references
-        this.servletContext = context;
-
-        // Perform other setup as needed
-    }
-
-
-    /**
-     * <p>Release references to allocated resources acquired in
-     * <code>initialize()</code> of via subsequent processing.  After this
-     * method is called, subsequent calls to any other method than
-     * <code>initialize()</code> will return undefined results.</p>
-     */
-    public void release() {
-
-        // Release references to allocated collections
-        applicationScope = null;
-        initParam = null;
-
-        // Release references to Servlet API objects
-        servletContext = null;
-
-    }
 }

Modified: tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/ServletRequest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/ServletRequest.java?rev=935400&r1=935399&r2=935400&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/ServletRequest.java (original)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/ServletRequest.java Sun Apr 18 20:18:25 2010
@@ -34,6 +34,14 @@ import javax.servlet.http.HttpServletRes
 
 import org.apache.tiles.request.AbstractClientRequest;
 import org.apache.tiles.request.ApplicationContext;
+import org.apache.tiles.request.collection.AddableParameterMap;
+import org.apache.tiles.request.collection.HeaderValuesMap;
+import org.apache.tiles.request.collection.ParameterMap;
+import org.apache.tiles.request.collection.ScopeMap;
+import org.apache.tiles.request.servlet.extractor.ParameterExtractor;
+import org.apache.tiles.request.servlet.extractor.RequestScopeExtractor;
+import org.apache.tiles.request.servlet.extractor.ServletHeaderExtractor;
+import org.apache.tiles.request.servlet.extractor.SessionScopeExtractor;
 
 /**
  * Servlet-based implementation of the TilesApplicationContext interface.
@@ -91,12 +99,6 @@ public class ServletRequest extends Abst
 
 
     /**
-     * <p>The lazily instantiated <code>Map</code> of request
-     * parameter name-values.</p>
-     */
-    private Map<String, String[]> paramValues = null;
-
-    /**
      * <p>The lazily instantiated <code>Map</code> of request scope
      * attributes.</p>
      */
@@ -121,14 +123,15 @@ public class ServletRequest extends Abst
             ApplicationContext applicationContext,
             HttpServletRequest request, HttpServletResponse response) {
         super(applicationContext);
-        initialize(request, response);
+        this.request = request;
+        this.response = response;
     }
 
     /** {@inheritDoc} */
     public Map<String, String> getHeader() {
 
         if ((header == null) && (request != null)) {
-            header = new ServletHeaderMap(request, response);
+            header = new AddableParameterMap(new ServletHeaderExtractor(request, response));
         }
         return (header);
 
@@ -139,7 +142,7 @@ public class ServletRequest extends Abst
     public Map<String, String[]> getHeaderValues() {
 
         if ((headerValues == null) && (request != null)) {
-            headerValues = new ServletHeaderValuesMap(request);
+            headerValues = new HeaderValuesMap(new ServletHeaderExtractor(request, response));
         }
         return (headerValues);
 
@@ -150,7 +153,7 @@ public class ServletRequest extends Abst
     public Map<String, String> getParam() {
 
         if ((param == null) && (request != null)) {
-            param = new ServletParamMap(request);
+            param = new ParameterMap(new ParameterExtractor(request));
         }
         return (param);
 
@@ -158,13 +161,9 @@ public class ServletRequest extends Abst
 
 
     /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
     public Map<String, String[]> getParamValues() {
-
-        if ((paramValues == null) && (request != null)) {
-            paramValues = new ServletParamValuesMap(request);
-        }
-        return (paramValues);
-
+        return request.getParameterMap();
     }
 
 
@@ -172,7 +171,7 @@ public class ServletRequest extends Abst
     public Map<String, Object> getRequestScope() {
 
         if ((requestScope == null) && (request != null)) {
-            requestScope = new ServletRequestScopeMap(request);
+            requestScope = new ScopeMap(new RequestScopeExtractor(request));
         }
         return (requestScope);
 
@@ -183,7 +182,7 @@ public class ServletRequest extends Abst
     public Map<String, Object> getSessionScope() {
 
         if ((sessionScope == null) && (request != null)) {
-            sessionScope = new ServletSessionScopeMap(request);
+            sessionScope = new ScopeMap(new SessionScopeExtractor(request));
         }
         return (sessionScope);
 
@@ -299,44 +298,6 @@ public class ServletRequest extends Abst
         return response;
     }
 
-    /**
-     * <p>Initialize (or reinitialize) this {@link ServletRequest} instance
-     * for the specified Servlet API objects.</p>
-     *
-     * @param request  The <code>HttpServletRequest</code> for this request
-     * @param response The <code>HttpServletResponse</code> for this request
-     */
-    public void initialize(HttpServletRequest request,
-                           HttpServletResponse response) {
-
-        // Save the specified Servlet API object references
-        this.request = request;
-        this.response = response;
-        // Perform other setup as needed
-    }
-
-
-    /**
-     * <p>Release references to allocated resources acquired in
-     * <code>initialize()</code> of via subsequent processing.  After this
-     * method is called, subsequent calls to any other method than
-     * <code>initialize()</code> will return undefined results.</p>
-     */
-    public void release() {
-        // Release references to allocated collections
-        header = null;
-        headerValues = null;
-        param = null;
-        paramValues = null;
-        requestScope = null;
-        sessionScope = null;
-
-        // Release references to Servlet API objects
-        request = null;
-        response = null;
-    }
-
-
     /** {@inheritDoc} */
     public boolean isUserInRole(String role) {
         return request.isUserInRole(role);

Added: tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ApplicationScopeExtractor.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ApplicationScopeExtractor.java?rev=935400&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ApplicationScopeExtractor.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ApplicationScopeExtractor.java Sun Apr 18 20:18:25 2010
@@ -0,0 +1,37 @@
+package org.apache.tiles.request.servlet.extractor;
+
+import java.util.Enumeration;
+
+import javax.servlet.ServletContext;
+
+import org.apache.tiles.request.collection.extractor.AttributeExtractor;
+
+public class ApplicationScopeExtractor implements AttributeExtractor {
+
+    private ServletContext context;
+
+    public ApplicationScopeExtractor(ServletContext context) {
+        this.context = context;
+    }
+
+    @Override
+    public void setValue(String name, Object value) {
+        context.setAttribute(name, value);
+    }
+
+    @Override
+    public void removeValue(String name) {
+        context.removeAttribute(name);
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public Enumeration<String> getKeys() {
+        return context.getAttributeNames();
+    }
+
+    @Override
+    public Object getValue(String key) {
+        return context.getAttribute(key);
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ApplicationScopeExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ApplicationScopeExtractor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/InitParameterExtractor.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/InitParameterExtractor.java?rev=935400&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/InitParameterExtractor.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/InitParameterExtractor.java Sun Apr 18 20:18:25 2010
@@ -0,0 +1,28 @@
+package org.apache.tiles.request.servlet.extractor;
+
+import java.util.Enumeration;
+
+import javax.servlet.ServletContext;
+
+import org.apache.tiles.request.collection.extractor.HasKeys;
+
+public class InitParameterExtractor implements HasKeys<String> {
+
+    private ServletContext context;
+
+    public InitParameterExtractor(ServletContext context) {
+        this.context = context;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public Enumeration<String> getKeys() {
+        return context.getInitParameterNames();
+    }
+
+    @Override
+    public String getValue(String key) {
+        return context.getInitParameter(key);
+    }
+
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/InitParameterExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/InitParameterExtractor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ParameterExtractor.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ParameterExtractor.java?rev=935400&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ParameterExtractor.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ParameterExtractor.java Sun Apr 18 20:18:25 2010
@@ -0,0 +1,27 @@
+package org.apache.tiles.request.servlet.extractor;
+
+import java.util.Enumeration;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.tiles.request.collection.extractor.HasKeys;
+
+public class ParameterExtractor implements HasKeys<String> {
+
+    private HttpServletRequest request;
+
+    public ParameterExtractor(HttpServletRequest request) {
+        this.request = request;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public Enumeration<String> getKeys() {
+        return request.getParameterNames();
+    }
+
+    @Override
+    public String getValue(String key) {
+        return request.getParameter(key);
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ParameterExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ParameterExtractor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/RequestScopeExtractor.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/RequestScopeExtractor.java?rev=935400&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/RequestScopeExtractor.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/RequestScopeExtractor.java Sun Apr 18 20:18:25 2010
@@ -0,0 +1,37 @@
+package org.apache.tiles.request.servlet.extractor;
+
+import java.util.Enumeration;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.tiles.request.collection.extractor.AttributeExtractor;
+
+public class RequestScopeExtractor implements AttributeExtractor {
+
+    private HttpServletRequest request;
+
+    public RequestScopeExtractor(HttpServletRequest request) {
+        this.request = request;
+    }
+
+    @Override
+    public void setValue(String name, Object value) {
+        request.setAttribute(name, value);
+    }
+
+    @Override
+    public void removeValue(String name) {
+        request.removeAttribute(name);
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public Enumeration<String> getKeys() {
+        return request.getAttributeNames();
+    }
+
+    @Override
+    public Object getValue(String key) {
+        return request.getAttribute(key);
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/RequestScopeExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/RequestScopeExtractor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ServletHeaderExtractor.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ServletHeaderExtractor.java?rev=935400&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ServletHeaderExtractor.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ServletHeaderExtractor.java Sun Apr 18 20:18:25 2010
@@ -0,0 +1,43 @@
+package org.apache.tiles.request.servlet.extractor;
+
+import java.util.Enumeration;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.tiles.request.collection.extractor.HeaderExtractor;
+
+public class ServletHeaderExtractor implements HeaderExtractor {
+
+    private HttpServletRequest request;
+
+    private HttpServletResponse response;
+
+    public ServletHeaderExtractor(HttpServletRequest request,
+            HttpServletResponse response) {
+        this.request = request;
+        this.response = response;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public Enumeration<String> getKeys() {
+        return request.getHeaderNames();
+   }
+
+    @Override
+    public String getValue(String key) {
+        return request.getHeader(key);
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public Enumeration<String> getValues(String key) {
+        return request.getHeaders(key);
+    }
+
+    @Override
+    public void setValue(String key, String value) {
+        response.setHeader(key, value);
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ServletHeaderExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-servlet/src/main/java/org/apache/tiles/request/servlet/extractor/ServletHeaderExtractor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL



Mime
View raw message