myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r512415 - in /myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context: portlet/ servlet/
Date Tue, 27 Feb 2007 21:20:15 GMT
Author: mbr
Date: Tue Feb 27 13:20:10 2007
New Revision: 512415

URL: http://svn.apache.org/viewvc?view=rev&rev=512415
Log:
generics injected
+ minor cleanup

Modified:
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/ApplicationMap.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/InitParameterMap.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/PortletExternalContextImpl.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestHeaderMap.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestHeaderValuesMap.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestMap.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestParameterMap.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestParameterValuesMap.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/SessionMap.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/AbstractAttributeMap.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/ApplicationMap.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/CookieMap.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/InitParameterMap.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestHeaderMap.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestHeaderValuesMap.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestMap.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestParameterMap.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestParameterValuesMap.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/SessionMap.java

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/ApplicationMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/ApplicationMap.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/ApplicationMap.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/ApplicationMap.java Tue Feb 27 13:20:10 2007
@@ -28,7 +28,7 @@
  * @author  Stan Silvert (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class ApplicationMap extends AbstractAttributeMap
+public class ApplicationMap extends AbstractAttributeMap<Object>
 {
     final PortletContext _portletContext;
 
@@ -37,32 +37,39 @@
         _portletContext = portletContext;
     }
 
+    @Override
     protected Object getAttribute(String key)
     {
         return _portletContext.getAttribute(key);
     }
 
+    @Override
     protected void setAttribute(String key, Object value)
     {
         _portletContext.setAttribute(key, value);
     }
 
+    @Override
     protected void removeAttribute(String key)
     {
         _portletContext.removeAttribute(key);
     }
 
-    protected Enumeration getAttributeNames()
+    @Override
+    @SuppressWarnings("unchecked")
+    protected Enumeration<String> getAttributeNames()
     {
         return _portletContext.getAttributeNames();
     }
 
+    @Override
     public void putAll(Map t)
     {
         throw new UnsupportedOperationException();
     }
 
 
+    @Override
     public void clear()
     {
         throw new UnsupportedOperationException();

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/InitParameterMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/InitParameterMap.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/InitParameterMap.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/InitParameterMap.java Tue Feb 27 13:20:10 2007
@@ -21,6 +21,7 @@
 import java.util.Map;
 
 import javax.portlet.PortletContext;
+
 import org.apache.myfaces.context.servlet.AbstractAttributeMap;
 
 
@@ -30,7 +31,7 @@
  * @author  Stan Silvert (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class InitParameterMap extends AbstractAttributeMap
+public class InitParameterMap extends AbstractAttributeMap<String>
 {
     final PortletContext _portletContext;
 
@@ -39,28 +40,34 @@
         _portletContext = portletContext;
     }
 
-    protected Object getAttribute(String key)
+    @Override
+    protected String getAttribute(String key)
     {
         return _portletContext.getInitParameter(key);
     }
 
-    protected void setAttribute(String key, Object value)
+    @Override
+    protected void setAttribute(String key, String value)
     {
         throw new UnsupportedOperationException(
             "Cannot set PortletContext InitParameter");
     }
 
+    @Override
     protected void removeAttribute(String key)
     {
         throw new UnsupportedOperationException(
             "Cannot remove PortletContext InitParameter");
     }
 
-    protected Enumeration getAttributeNames()
+    @Override
+    @SuppressWarnings("unchecked")
+    protected Enumeration<String> getAttributeNames()
     {
         return _portletContext.getInitParameterNames();
     }
 
+    @Override
     public boolean equals(Object o) {
         boolean retValue;
 
@@ -68,6 +75,7 @@
         return retValue;
     }
 
+    @Override
     public int hashCode() {
         int retValue;
 
@@ -75,12 +83,14 @@
         return retValue;
     }
     
+    @Override
     public void putAll(Map t)
     {
         throw new UnsupportedOperationException();
     }
 
 
+    @Override
     public void clear()
     {
         throw new UnsupportedOperationException();

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/PortletExternalContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/PortletExternalContextImpl.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/PortletExternalContextImpl.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/PortletExternalContextImpl.java Tue Feb 27 13:20:10 2007
@@ -21,14 +21,12 @@
 import java.net.URL;
 import java.security.Principal;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
 import javax.faces.FacesException;
-import javax.faces.application.ViewHandler;
 import javax.faces.context.ExternalContext;
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
@@ -37,45 +35,41 @@
 import javax.portlet.PortletRequest;
 import javax.portlet.PortletRequestDispatcher;
 import javax.portlet.PortletResponse;
-import javax.portlet.PortletSession;
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.myfaces.context.ReleaseableExternalContext;
 import org.apache.myfaces.util.EnumerationIterator;
 
 /**
- * An ExternalContext implementation for JSF applications that run inside a
- * a Portlet.
- *
- * @author  Stan Silvert (latest modification by $Author$)
+ * An ExternalContext implementation for JSF applications that run inside a Portlet.
+ * 
+ * @author Stan Silvert (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class PortletExternalContextImpl extends ExternalContext implements ReleaseableExternalContext {
+public class PortletExternalContextImpl extends ExternalContext implements ReleaseableExternalContext
+{
 
     private static final String INIT_PARAMETER_MAP_ATTRIBUTE = InitParameterMap.class.getName();
-    private static final Map EMPTY_UNMODIFIABLE_MAP = Collections.EMPTY_MAP;
 
     PortletContext _portletContext;
     PortletRequest _portletRequest;
     PortletResponse _portletResponse;
 
-    private Map _applicationMap;
-    private Map _sessionMap;
-    private Map _requestMap;
-    private Map _requestParameterMap;
-    private Map _requestParameterValuesMap;
-    private Map _requestHeaderMap;
-    private Map _requestHeaderValuesMap;
-    private Map _initParameterMap;
+    private Map<String, Object> _applicationMap;
+    private Map<String, Object> _sessionMap;
+    private Map<String, Object> _requestMap;
+    private Map<String, String> _requestParameterMap;
+    private Map<String, String[]> _requestParameterValuesMap;
+    private Map<String, String> _requestHeaderMap;
+    private Map<String, String[]> _requestHeaderValuesMap;
+    private Map<String, String> _initParameterMap;
+
     private ActionRequest _actionRequest;
 
     /** Creates a new instance of PortletFacesContextImpl */
-    public PortletExternalContextImpl(PortletContext portletContext,
-                                      PortletRequest portletRequest,
-                                      PortletResponse portletResponse)
+    public PortletExternalContextImpl(PortletContext portletContext, PortletRequest portletRequest,
+            PortletResponse portletResponse)
     {
         _portletContext = portletContext;
         _portletRequest = portletRequest;
@@ -88,15 +82,14 @@
         if (_actionRequest != null)
         { // dispatch only allowed for RenderRequest
             String msg = "Can not call dispatch() during a portlet ActionRequest";
-            throw new IllegalStateException(msg);
+            throw new UnsupportedOperationException(msg);
         }
 
         PortletRequestDispatcher requestDispatcher
             = _portletContext.getRequestDispatcher(path); //TODO: figure out why I need named dispatcher
         try
         {
-            requestDispatcher.include((RenderRequest)_portletRequest,
-                                      (RenderResponse)_portletResponse);
+            requestDispatcher.include((RenderRequest) _portletRequest, (RenderResponse) _portletResponse);
         }
         catch (PortletException e)
         {
@@ -108,30 +101,36 @@
         }
     }
 
-    public String encodeActionURL(String url) {
+    public String encodeActionURL(String url)
+    {
         checkNull(url, "url");
         return _portletResponse.encodeURL(url);
     }
 
-    public String encodeNamespace(String name) {
+    public String encodeNamespace(String name)
+    {
         if (_actionRequest != null)
-        { // encodeNamespace only allowed for RenderRequest
-            String msg = "Can not call encodeNamespace() during a portlet ActionRequest";
-            throw new IllegalStateException(msg);
+        {
+            // encodeNamespace only allowed for RenderRequest
+            throw new UnsupportedOperationException("Can not call encodeNamespace() during a portlet ActionRequest");
         }
 
-        //we render out the name and then the namespace as
+        // we render out the name and then the namespace as
         // e.g. for JSF-ids, it is important to keep the _id prefix
-        //to know that id creation has happened automatically
-        return name+((RenderResponse)_portletResponse).getNamespace();
+        // to know that id creation has happened automatically
+        return name + ((RenderResponse) _portletResponse).getNamespace();
     }
 
-    public String encodeResourceURL(String url) {
+    @Override
+    public String encodeResourceURL(String url)
+    {
         checkNull(url, "url");
         return _portletResponse.encodeURL(url);
     }
 
-    public Map getApplicationMap() {
+    @Override
+    public Map<String, Object> getApplicationMap()
+    {
         if (_applicationMap == null)
         {
             _applicationMap = new ApplicationMap(_portletContext);
@@ -139,23 +138,32 @@
         return _applicationMap;
     }
 
-    public String getAuthType() {
+    @Override
+    public String getAuthType()
+    {
         return _portletRequest.getAuthType();
     }
 
-    public Object getContext() {
+    @Override
+    public Object getContext()
+    {
         return _portletContext;
     }
 
-    public String getInitParameter(String name) {
+    @Override
+    public String getInitParameter(String name)
+    {
         return _portletContext.getInitParameter(name);
     }
 
-    public Map getInitParameterMap() {
+    @Override
+    @SuppressWarnings("unchecked")
+    public Map<String, String> getInitParameterMap()
+    {
         if (_initParameterMap == null)
         {
             // We cache it as an attribute in PortletContext itself (is this circular reference a problem?)
-            if ((_initParameterMap = (Map) _portletContext.getAttribute(INIT_PARAMETER_MAP_ATTRIBUTE)) == null)
+            if ((_initParameterMap = (Map<String, String>) _portletContext.getAttribute(INIT_PARAMETER_MAP_ATTRIBUTE)) == null)
             {
                 _initParameterMap = new InitParameterMap(_portletContext);
                 _portletContext.setAttribute(INIT_PARAMETER_MAP_ATTRIBUTE, _initParameterMap);
@@ -164,27 +172,40 @@
         return _initParameterMap;
     }
 
-    public String getRemoteUser() {
+    @Override
+    public String getRemoteUser()
+    {
         return _portletRequest.getRemoteUser();
     }
 
-    public Object getRequest() {
+    @Override
+    public Object getRequest()
+    {
         return _portletRequest;
     }
 
-    public String getRequestContentType() {
+    @Override
+    public String getRequestContentType()
+    {
         return null;
     }
-    
-    public String getRequestContextPath() {
+
+    @Override
+    public String getRequestContextPath()
+    {
         return _portletRequest.getContextPath();
     }
 
-    public Map getRequestCookieMap() {
-        return EMPTY_UNMODIFIABLE_MAP;
+    @Override
+    @SuppressWarnings("unchecked")
+    public Map<String, Object> getRequestCookieMap()
+    {
+        return Collections.EMPTY_MAP;
     }
 
-    public Map getRequestHeaderMap() {
+    @Override
+    public Map<String, String> getRequestHeaderMap()
+    {
         if (_requestHeaderMap == null)
         {
             _requestHeaderMap = new RequestHeaderMap(_portletRequest);
@@ -192,7 +213,9 @@
         return _requestHeaderMap;
     }
 
-    public Map getRequestHeaderValuesMap() {
+    @Override
+    public Map<String, String[]> getRequestHeaderValuesMap()
+    {
         if (_requestHeaderValuesMap == null)
         {
             _requestHeaderValuesMap = new RequestHeaderValuesMap(_portletRequest);
@@ -200,15 +223,22 @@
         return _requestHeaderValuesMap;
     }
 
-    public Locale getRequestLocale() {
+    @Override
+    public Locale getRequestLocale()
+    {
         return _portletRequest.getLocale();
     }
 
-    public Iterator getRequestLocales() {
+    @SuppressWarnings("unchecked")
+    @Override
+    public Iterator<Locale> getRequestLocales()
+    {
         return new EnumerationIterator(_portletRequest.getLocales());
     }
 
-    public Map getRequestMap() {
+    @Override
+    public Map<String, Object> getRequestMap()
+    {
         if (_requestMap == null)
         {
             _requestMap = new RequestMap(_portletRequest);
@@ -216,7 +246,9 @@
         return _requestMap;
     }
 
-    public Map getRequestParameterMap() {
+    @Override
+    public Map<String, String> getRequestParameterMap()
+    {
         if (_requestParameterMap == null)
         {
             _requestParameterMap = new RequestParameterMap(_portletRequest);
@@ -224,12 +256,16 @@
         return _requestParameterMap;
     }
 
-    public Iterator getRequestParameterNames() {
-        // TODO: find out why it is not done this way in ServletExternalContextImpl
+    @SuppressWarnings("unchecked")
+    @Override
+    public Iterator<String> getRequestParameterNames()
+    {
         return new EnumerationIterator(_portletRequest.getParameterNames());
     }
 
-    public Map getRequestParameterValuesMap() {
+    @Override
+    public Map<String, String[]> getRequestParameterValuesMap()
+    {
         if (_requestParameterValuesMap == null)
         {
             _requestParameterValuesMap = new RequestParameterValuesMap(_portletRequest);
@@ -237,44 +273,63 @@
         return _requestParameterValuesMap;
     }
 
-    public String getRequestPathInfo() {
+    @Override
+    public String getRequestPathInfo()
+    {
         return null; // must return null
     }
 
-    public String getRequestServletPath() {
+    @Override
+    public String getRequestServletPath()
+    {
         return null; // must return null
     }
 
-    public URL getResource(String path) throws MalformedURLException {
+    @Override
+    public URL getResource(String path) throws MalformedURLException
+    {
         checkNull(path, "path");
 
         return _portletContext.getResource(path);
     }
 
-    public InputStream getResourceAsStream(String path) {
+    @Override
+    public InputStream getResourceAsStream(String path)
+    {
         checkNull(path, "path");
 
         return _portletContext.getResourceAsStream(path);
     }
 
-    public Set getResourcePaths(String path) {
+    @Override
+    @SuppressWarnings("unchecked")
+    public Set<String> getResourcePaths(String path)
+    {
         checkNull(path, "path");
         return _portletContext.getResourcePaths(path);
     }
 
-    public Object getResponse() {
+    @Override
+    public Object getResponse()
+    {
         return _portletResponse;
     }
 
-    public String getResponseContentType() {
+    @Override
+    public String getResponseContentType()
+    {
         return null;
     }
-    
-    public Object getSession(boolean create) {
+
+    @Override
+    public Object getSession(boolean create)
+    {
         return _portletRequest.getPortletSession(create);
     }
 
-    public Map getSessionMap() {
+    @Override
+    public Map<String, Object> getSessionMap()
+    {
         if (_sessionMap == null)
         {
             _sessionMap = new SessionMap(_portletRequest);
@@ -282,33 +337,43 @@
         return _sessionMap;
     }
 
-    public Principal getUserPrincipal() {
+    @Override
+    public Principal getUserPrincipal()
+    {
         return _portletRequest.getUserPrincipal();
     }
 
-    public boolean isUserInRole(String role) {
+    @Override
+    public boolean isUserInRole(String role)
+    {
         checkNull(role, "role");
 
         return _portletRequest.isUserInRole(role);
     }
 
-    public void log(String message) {
+    @Override
+    public void log(String message)
+    {
         checkNull(message, "message");
 
         _portletContext.log(message);
     }
 
-    public void log(String message, Throwable exception) {
+    @Override
+    public void log(String message, Throwable exception)
+    {
         checkNull(message, "message");
         checkNull(exception, "exception");
 
         _portletContext.log(message, exception);
     }
 
-    public void redirect(String url) throws IOException {
-        if (_portletResponse instanceof ActionResponse)
+    @Override
+    public void redirect(String url) throws IOException
+    {
+        if (_actionRequest instanceof ActionResponse)
         {
-            ((ActionResponse)_portletResponse).sendRedirect(url);
+            ((ActionResponse) _portletResponse).sendRedirect(url);
         }
         else
         {
@@ -316,7 +381,8 @@
         }
     }
 
-    public void release() {
+    public void release()
+    {
         _portletContext = null;
         _portletRequest = null;
         _portletResponse = null;
@@ -330,22 +396,18 @@
         _initParameterMap = null;
         _actionRequest = null;
     }
-    
-    private boolean isActionRequest(PortletRequest portletRequest)
-    {
-        return (portletRequest != null && portletRequest instanceof ActionRequest);
-    }
-    
+
     /**
      * @since JSF 1.2
      * @param request
      */
+    @Override
     public void setRequest(java.lang.Object request)
     {
-      this._portletRequest = (PortletRequest) request;
-      this._actionRequest = this.isActionRequest(_portletRequest) ?  (ActionRequest) request : null;
+        this._portletRequest = (PortletRequest) request;
+        this._actionRequest = isActionRequest(_portletRequest) ? (ActionRequest) request : null;
     }
-    
+
     /**
      * @since JSF 1.2
      * @param encoding
@@ -355,18 +417,18 @@
         throws java.io.UnsupportedEncodingException{
       
         if(_actionRequest != null)
-            ((ActionRequest) this._portletRequest).setCharacterEncoding(encoding);
-        throw new UnsupportedOperationException("Can not set request character encoding to value '" + encoding
-                + "'. Request is not an action request");
-      
+            _actionRequest.setCharacterEncoding(encoding);
+        else
+            throw new UnsupportedOperationException("Can not set request character encoding to value '" + encoding
+                    + "'. Request is not an action request");
     }
-    
+
     @Override
     public String getRequestCharacterEncoding()
     {
         if(_actionRequest != null)
             return _actionRequest.getCharacterEncoding();
-        return null;
+        throw new UnsupportedOperationException("Can not get request character encoding. Request is not an action request");
     }
     
     @Override
@@ -379,20 +441,21 @@
      * @since JSF 1.2
      * @param response
      */
+    @Override
     public void setResponse(java.lang.Object response)
     {
         this._portletResponse = (PortletResponse) response;
     }
-    
+
     /**
      * @since JSF 1.2
      * @param encoding
      */
+    @Override
     public void setResponseCharacterEncoding(java.lang.String encoding)
     {
-      //nope!
+        // nope!
     }
-    
 
     private void checkNull(Object o, String param)
     {
@@ -400,6 +463,11 @@
         {
             throw new NullPointerException(param + " can not be null.");
         }
+    }
+    
+    private boolean isActionRequest(PortletRequest portletRequest)
+    {
+        return portletRequest instanceof ActionRequest;
     }
 
 }

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestHeaderMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestHeaderMap.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestHeaderMap.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestHeaderMap.java Tue Feb 27 13:20:10 2007
@@ -18,6 +18,7 @@
 import java.util.Enumeration;
 import java.util.Map;
 import javax.portlet.PortletRequest;
+
 import org.apache.myfaces.context.servlet.AbstractAttributeMap;
 
 
@@ -28,7 +29,7 @@
  * @author  Stan Silvert (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class RequestHeaderMap extends AbstractAttributeMap
+public class RequestHeaderMap extends AbstractAttributeMap<String>
 {
     private final PortletRequest _portletRequest;
 
@@ -37,34 +38,41 @@
         _portletRequest = portletRequest;
     }
 
-    protected Object getAttribute(String key)
+    @Override
+    protected String getAttribute(String key)
     {
         return _portletRequest.getProperty(key);
     }
 
-    protected void setAttribute(String key, Object value)
+    @Override
+    protected void setAttribute(String key, String value)
     {
         throw new UnsupportedOperationException(
             "Cannot set PortletRequest property");
     }
 
+    @Override
     protected void removeAttribute(String key)
     {
         throw new UnsupportedOperationException(
             "Cannot remove PortletRequest property");
     }
 
-    protected Enumeration getAttributeNames()
+    @Override
+    @SuppressWarnings("unchecked")
+    protected Enumeration<String> getAttributeNames()
     {
         return _portletRequest.getPropertyNames();
     }
 
+    @Override
     public void putAll(Map t)
     {
         throw new UnsupportedOperationException();
     }
 
 
+    @Override
     public void clear()
     {
         throw new UnsupportedOperationException();

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestHeaderValuesMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestHeaderValuesMap.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestHeaderValuesMap.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestHeaderValuesMap.java Tue Feb 27 13:20:10 2007
@@ -20,64 +20,64 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
 import javax.portlet.PortletRequest;
 
 import org.apache.myfaces.context.servlet.AbstractAttributeMap;
 
 /**
  * PortletRequest header values (multi-value headers) as Map of String[].
- *
- * @author  Stan Silvert (latest modification by $Author$)
+ * 
+ * @author Stan Silvert (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class RequestHeaderValuesMap extends AbstractAttributeMap
+public class RequestHeaderValuesMap extends AbstractAttributeMap<String[]>
 {
     private final PortletRequest _portletRequest;
-    private final Map<String, Object>            _valueCache = new HashMap<String, Object>();
+    private final Map<String, String[]> _valueCache = new HashMap<String, String[]>();
 
     RequestHeaderValuesMap(PortletRequest portletRequest)
     {
         _portletRequest = portletRequest;
     }
 
-    protected Object getAttribute(String key)
+    @SuppressWarnings("unchecked")
+    protected String[] getAttribute(String key)
     {
-        Object ret = _valueCache.get(key);
+        String[] ret = _valueCache.get(key);
         if (ret == null)
         {
-            _valueCache.put(key, ret = toArray(_portletRequest
-                .getProperties(key)));
+            _valueCache.put(key, ret = toArray(_portletRequest.getProperties(key)));
         }
 
         return ret;
     }
 
-    protected void setAttribute(String key, Object value)
+    protected void setAttribute(String key, String[] value)
     {
-        throw new UnsupportedOperationException(
-            "Cannot set PortletRequest Properties");
+        throw new UnsupportedOperationException("Cannot set PortletRequest Properties");
     }
 
     protected void removeAttribute(String key)
     {
-        throw new UnsupportedOperationException(
-            "Cannot remove PortletRequest Properties");
+        throw new UnsupportedOperationException("Cannot remove PortletRequest Properties");
     }
 
-    protected Enumeration getAttributeNames()
+    @SuppressWarnings("unchecked")
+    protected Enumeration<String> getAttributeNames()
     {
         return _portletRequest.getPropertyNames();
     }
 
-    private String[] toArray(Enumeration e)
+    private String[] toArray(Enumeration<String> e)
     {
-        List ret = new ArrayList();
+        List<String> ret = new ArrayList<String>();
 
         while (e.hasMoreElements())
         {
             ret.add(e.nextElement());
         }
 
-        return (String[]) ret.toArray(new String[ret.size()]);
+        return ret.toArray(new String[ret.size()]);
     }
 }

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestMap.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestMap.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestMap.java Tue Feb 27 13:20:10 2007
@@ -18,6 +18,7 @@
 import java.util.Enumeration;
 import java.util.Map;
 import javax.portlet.PortletRequest;
+
 import org.apache.myfaces.context.servlet.AbstractAttributeMap;
 
 
@@ -27,7 +28,7 @@
  * @author  Stan Silvert (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class RequestMap extends AbstractAttributeMap
+public class RequestMap extends AbstractAttributeMap<Object>
 {
     final PortletRequest _portletRequest;
 
@@ -36,32 +37,39 @@
         _portletRequest = portletRequest;
     }
 
+    @Override
     protected Object getAttribute(String key)
     {
         return _portletRequest.getAttribute(key);
     }
 
+    @Override
     protected void setAttribute(String key, Object value)
     {
         _portletRequest.setAttribute(key, value);
     }
 
+    @Override
     protected void removeAttribute(String key)
     {
         _portletRequest.removeAttribute(key);
     }
 
-    protected Enumeration getAttributeNames()
+    @Override
+    @SuppressWarnings("unchecked")
+    protected Enumeration<String> getAttributeNames()
     {
         return _portletRequest.getAttributeNames();
     }
 
+    @Override
     public void putAll(Map t)
     {
         throw new UnsupportedOperationException();
     }
 
 
+    @Override
     public void clear()
     {
         throw new UnsupportedOperationException();

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestParameterMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestParameterMap.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestParameterMap.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestParameterMap.java Tue Feb 27 13:20:10 2007
@@ -26,7 +26,7 @@
  * @author  Stan Silvert (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class RequestParameterMap extends AbstractAttributeMap
+public class RequestParameterMap extends AbstractAttributeMap<String>
 {
     private final PortletRequest _portletRequest;
 
@@ -35,24 +35,29 @@
         _portletRequest = portletRequest;
     }
 
-    protected Object getAttribute(String key)
+    @Override
+    protected String getAttribute(String key)
     {
         return _portletRequest.getParameter(key);
     }
 
-    protected void setAttribute(String key, Object value)
+    @Override
+    protected void setAttribute(String key, String value)
     {
         throw new UnsupportedOperationException(
             "Cannot set PortletRequest Parameter");
     }
 
+    @Override
     protected void removeAttribute(String key)
     {
         throw new UnsupportedOperationException(
             "Cannot remove PortletRequest Parameter");
     }
 
-    protected Enumeration getAttributeNames()
+    @Override
+    @SuppressWarnings("unchecked")
+    protected Enumeration<String> getAttributeNames()
     {
         return _portletRequest.getParameterNames();
     }

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestParameterValuesMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestParameterValuesMap.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestParameterValuesMap.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/RequestParameterValuesMap.java Tue Feb 27 13:20:10 2007
@@ -17,6 +17,7 @@
 
 import java.util.Enumeration;
 import javax.portlet.PortletRequest;
+
 import org.apache.myfaces.context.servlet.AbstractAttributeMap;
 
 /**
@@ -25,7 +26,7 @@
  * @author  Stan Silvert (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class RequestParameterValuesMap extends AbstractAttributeMap
+public class RequestParameterValuesMap extends AbstractAttributeMap<String[]>
 {
     private final PortletRequest _portletRequest;
 
@@ -34,24 +35,29 @@
         _portletRequest = portletRequest;
     }
 
-    protected Object getAttribute(String key)
+    @Override
+    protected String[] getAttribute(String key)
     {
         return _portletRequest.getParameterValues(key);
     }
 
-    protected void setAttribute(String key, Object value)
+    @Override
+    protected void setAttribute(String key, String[] value)
     {
         throw new UnsupportedOperationException(
             "Cannot set PortletRequest ParameterValues");
     }
 
+    @Override
     protected void removeAttribute(String key)
     {
         throw new UnsupportedOperationException(
             "Cannot remove PortletRequest ParameterValues");
     }
 
-    protected Enumeration getAttributeNames()
+    @Override
+    @SuppressWarnings("unchecked")
+    protected Enumeration<String> getAttributeNames()
     {
         return _portletRequest.getParameterNames();
     }

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/SessionMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/SessionMap.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/SessionMap.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/portlet/SessionMap.java Tue Feb 27 13:20:10 2007
@@ -15,13 +15,13 @@
  */
 package org.apache.myfaces.context.portlet;
 
+import org.apache.myfaces.context.servlet.AbstractAttributeMap;
 import org.apache.myfaces.shared_impl.util.NullEnumeration;
 
 import java.util.Enumeration;
 import java.util.Map;
 import javax.portlet.PortletRequest;
 import javax.portlet.PortletSession;
-import org.apache.myfaces.context.servlet.AbstractAttributeMap;
 
 /**
  * Portlet scope PortletSession attibutes as Map.
@@ -29,7 +29,7 @@
  * @author  Stan Silvert (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class SessionMap extends AbstractAttributeMap
+public class SessionMap extends AbstractAttributeMap<Object>
 {
     private final PortletRequest _portletRequest;
 
@@ -38,6 +38,7 @@
         _portletRequest = portletRequest;
     }
 
+    @Override
     protected Object getAttribute(String key)
     {
         PortletSession portletSession = getSession();
@@ -45,11 +46,13 @@
                ? null : portletSession.getAttribute(key.toString(), PortletSession.PORTLET_SCOPE);
     }
 
+    @Override
     protected void setAttribute(String key, Object value)
     {
         _portletRequest.getPortletSession(true).setAttribute(key, value, PortletSession.PORTLET_SCOPE);
     }
 
+    @Override
     protected void removeAttribute(String key)
     {
         PortletSession portletSession = getSession();
@@ -59,7 +62,9 @@
         }
     }
 
-    protected Enumeration getAttributeNames()
+    @Override
+    @SuppressWarnings("unchecked")
+    protected Enumeration<String> getAttributeNames()
     {
         PortletSession portletSession = getSession();
         return (portletSession == null)
@@ -72,6 +77,7 @@
         return _portletRequest.getPortletSession(false);
     }
 
+    @Override
     public void putAll(Map t)
     {
         throw new UnsupportedOperationException();
@@ -82,6 +88,7 @@
      * This will clear the session without invalidation.  If no session has
      * been created, it will simply return.
      */
+    @Override
     public void clear()
     {
         PortletSession session = getSession();

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/AbstractAttributeMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/AbstractAttributeMap.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/AbstractAttributeMap.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/AbstractAttributeMap.java Tue Feb 27 13:20:10 2007
@@ -26,24 +26,22 @@
 import java.util.NoSuchElementException;
 import java.util.Set;
 
-
 /**
  * Helper Map implementation for use with different Attribute Maps.
- *
+ * 
  * @author Anton Koinov (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public abstract class AbstractAttributeMap
-    extends AbstractMap
+public abstract class AbstractAttributeMap<V> extends AbstractMap<String, V>
 {
-    private Set              _keySet;
-    private Collection       _values;
-    private Set              _entrySet;
+    private Set<String> _keySet;
+    private Collection<V> _values;
+    private Set<Entry<String, V>> _entrySet;
 
     public void clear()
     {
-        List names = new ArrayList();
-        for (Enumeration e = getAttributeNames(); e.hasMoreElements();)
+        List<String> names = new ArrayList<String>();
+        for (Enumeration<String> e = getAttributeNames(); e.hasMoreElements();)
         {
             names.add(e.nextElement());
         }
@@ -66,9 +64,9 @@
             return false;
         }
 
-        for (Enumeration e = getAttributeNames(); e.hasMoreElements();)
+        for (Enumeration<String> e = getAttributeNames(); e.hasMoreElements();)
         {
-            Object value = getAttribute((String) e.nextElement());
+            Object value = getAttribute(e.nextElement());
             if (findValue.equals(value))
             {
                 return true;
@@ -78,12 +76,13 @@
         return false;
     }
 
-    public Set entrySet()
+    @Override
+    public Set<Entry<String, V>> entrySet()
     {
         return (_entrySet != null) ? _entrySet : (_entrySet = new EntrySet());
     }
 
-    public Object get(Object key)
+    public V get(Object key)
     {
         return getAttribute(key.toString());
     }
@@ -93,36 +92,37 @@
         return !getAttributeNames().hasMoreElements();
     }
 
-    public Set keySet()
+    public Set<String> keySet()
     {
         return (_keySet != null) ? _keySet : (_keySet = new KeySet());
     }
 
-    public Object put(Object key, Object value)
+    public V put(String key, V value)
     {
-        String key_ = key.toString();
-        Object retval = getAttribute(key_);
-        setAttribute(key_, value);
+        V retval = getAttribute(key);
+        setAttribute(key, value);
         return retval;
     }
 
-    public void putAll(Map t)
+    public void putAll(Map<? extends String, ? extends V> t)
     {
-        for (Iterator it = t.entrySet().iterator(); it.hasNext();)
+        for (Iterator<? extends Entry<? extends String, ? extends V>> it = t.entrySet().iterator(); it.hasNext();)
         {
-            Entry entry = (Entry) it.next();
-            setAttribute(entry.getKey().toString(), entry.getValue());
+            Entry<? extends String, ? extends V> entry = it.next();
+            setAttribute(entry.getKey(), entry.getValue());
         }
     }
 
-    public Object remove(Object key)
+    @Override
+    public V remove(Object key)
     {
         String key_ = key.toString();
-        Object retval = getAttribute(key_);
+        V retval = getAttribute(key_);
         removeAttribute(key_);
         return retval;
     }
 
+    @Override
     public int size()
     {
         int size = 0;
@@ -134,69 +134,75 @@
         return size;
     }
 
-    public Collection values()
+    @Override
+    public Collection<V> values()
     {
         return (_values != null) ? _values : (_values = new Values());
     }
 
+    abstract protected V getAttribute(String key);
 
-    abstract protected Object getAttribute(String key);
-
-    abstract protected void setAttribute(String key, Object value);
+    abstract protected void setAttribute(String key, V value);
 
     abstract protected void removeAttribute(String key);
 
-    abstract protected Enumeration getAttributeNames();
-
+    abstract protected Enumeration<String> getAttributeNames();
 
-    private class KeySet extends AbstractSet
+    private abstract class AbstractAttributeSet<E> extends AbstractSet<E>
     {
-        public Iterator iterator()
-        {
-            return new KeyIterator();
-        }
-
+        @Override
         public boolean isEmpty()
         {
             return AbstractAttributeMap.this.isEmpty();
         }
 
+        @Override
         public int size()
         {
             return AbstractAttributeMap.this.size();
         }
 
+        @Override
         public boolean contains(Object o)
         {
             return AbstractAttributeMap.this.containsKey(o);
         }
 
+        @Override
         public boolean remove(Object o)
         {
             return AbstractAttributeMap.this.remove(o) != null;
         }
 
+        @Override
         public void clear()
         {
             AbstractAttributeMap.this.clear();
         }
     }
 
-    private class KeyIterator
-        implements Iterator
+    private class KeySet extends AbstractAttributeSet<String>
+    {
+        @Override
+        public Iterator<String> iterator()
+        {
+            return new KeyIterator();
+        }
+    }
+
+    private abstract class AbstractAttributeIterator<E> implements Iterator<E>
     {
-        protected final Enumeration _e = getAttributeNames();
-        protected Object            _currentKey;
+        protected final Enumeration<String> _e = getAttributeNames();
+        protected String _currentKey;
 
         public void remove()
         {
             // remove() may cause ConcurrentModificationException.
             // We could throw an exception here, but not throwing an exception
-            //   allows one call to remove() to succeed
+            // allows one call to remove() to succeed
             if (_currentKey == null)
             {
-                throw new NoSuchElementException(
-                    "You must call next() at least once");
+                throw new NoSuchElementException("You must call next() at least once");
             }
             AbstractAttributeMap.this.remove(_currentKey);
         }
@@ -206,24 +212,32 @@
             return _e.hasMoreElements();
         }
 
-        public Object next()
+        public E next()
         {
-            return _currentKey = _e.nextElement();
+            return getValue(_currentKey = _e.nextElement());
         }
+
+        protected abstract E getValue(String attributeName);
     }
 
-    private class Values extends KeySet
+    private class KeyIterator extends AbstractAttributeIterator<String>
     {
-        public Iterator iterator()
+        @Override
+        protected String getValue(String attributeName)
         {
-            return new ValuesIterator();
+            return attributeName;
         }
+    }
 
-        public boolean contains(Object o)
+    private class Values extends AbstractAttributeSet<V>
+    {
+        @Override
+        public Iterator<V> iterator()
         {
-            return AbstractAttributeMap.this.containsValue(o);
+            return new ValuesIterator();
         }
 
+        @Override
         public boolean remove(Object o)
         {
             if (o == null)
@@ -244,22 +258,26 @@
         }
     }
 
-    private class ValuesIterator extends KeyIterator
+    private class ValuesIterator extends AbstractAttributeIterator<V>
     {
-        public Object next()
+        @Override
+        protected V getValue(String attributeName)
         {
-            super.next();
-            return AbstractAttributeMap.this.get(_currentKey);
+            return AbstractAttributeMap.this.get(attributeName);
         }
     }
 
-    private class EntrySet extends KeySet
+    private class EntrySet extends AbstractAttributeSet<Entry<String, V>>
     {
-        public Iterator iterator() {
+        @Override
+        public Iterator<Entry<String, V>> iterator()
+        {
             return new EntryIterator();
         }
 
-        public boolean contains(Object o) {
+        @Override
+        public boolean contains(Object o)
+        {
             if (!(o instanceof Entry))
             {
                 return false;
@@ -276,7 +294,9 @@
             return value.equals(AbstractAttributeMap.this.get(key));
         }
 
-        public boolean remove(Object o) {
+        @Override
+        public boolean remove(Object o)
+        {
             if (!(o instanceof Entry))
             {
                 return false;
@@ -285,8 +305,7 @@
             Entry entry = (Entry) o;
             Object key = entry.getKey();
             Object value = entry.getValue();
-            if (key == null || value == null
-                || !value.equals(AbstractAttributeMap.this.get(key)))
+            if (key == null || value == null || !value.equals(AbstractAttributeMap.this.get(key)))
             {
                 return false;
             }
@@ -296,41 +315,40 @@
     }
 
     /**
-     * Not very efficient since it generates a new instance of <code>Entry</code>
-     * for each element and still internaly uses the <code>KeyIterator</code>.
-     * It is more efficient to use the <code>KeyIterator</code> directly.
+     * Not very efficient since it generates a new instance of <code>Entry</code> for each element and still internaly
+     * uses the <code>KeyIterator</code>. It is more efficient to use the <code>KeyIterator</code> directly.
      */
-    private class EntryIterator extends KeyIterator
+    private class EntryIterator extends AbstractAttributeIterator<Entry<String, V>>
     {
-        public Object next()
+        @Override
+        protected Entry<String, V> getValue(String attributeName)
         {
-            super.next();
             // Must create new Entry every time--value of the entry must stay
             // linked to the same attribute name
-            return new EntrySetEntry(_currentKey);
+            return new EntrySetEntry(attributeName);
         }
     }
 
-    private class EntrySetEntry implements Entry
+    private class EntrySetEntry implements Entry<String, V>
     {
-        private final Object _currentKey;
+        private final String _currentKey;
 
-        public EntrySetEntry(Object currentKey)
+        public EntrySetEntry(String currentKey)
         {
             _currentKey = currentKey;
         }
 
-        public Object getKey()
+        public String getKey()
         {
             return _currentKey;
         }
 
-        public Object getValue()
+        public V getValue()
         {
             return AbstractAttributeMap.this.get(_currentKey);
         }
 
-        public Object setValue(Object value)
+        public V setValue(V value)
         {
             return AbstractAttributeMap.this.put(_currentKey, value);
         }

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/ApplicationMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/ApplicationMap.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/ApplicationMap.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/ApplicationMap.java Tue Feb 27 13:20:10 2007
@@ -27,7 +27,7 @@
  * @author Anton Koinov (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class ApplicationMap extends AbstractAttributeMap
+public class ApplicationMap extends AbstractAttributeMap<Object>
 {
     final ServletContext _servletContext;
 
@@ -51,7 +51,8 @@
         _servletContext.removeAttribute(key);
     }
 
-    protected Enumeration getAttributeNames()
+    @SuppressWarnings("unchecked")
+    protected Enumeration<String> getAttributeNames()
     {
         return _servletContext.getAttributeNames();
     }

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/CookieMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/CookieMap.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/CookieMap.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/CookieMap.java Tue Feb 27 13:20:10 2007
@@ -17,6 +17,7 @@
 
 import java.util.Enumeration;
 import java.util.Map;
+import java.util.NoSuchElementException;
 
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
@@ -28,7 +29,7 @@
  * @author Anton Koinov
  * @version $Revision$ $Date$
  */
-public class CookieMap extends AbstractAttributeMap
+public class CookieMap extends AbstractAttributeMap<Cookie>
 {
     private static final Cookie[] EMPTY_ARRAY = new Cookie[0];
 
@@ -60,6 +61,7 @@
         return false;
     }
 
+    @Override
     public boolean containsValue(Object findValue)
     {
         if (findValue == null)
@@ -68,7 +70,8 @@
         }
 
         Cookie[] cookies = _httpServletRequest.getCookies();
-        if (cookies == null) return false;
+        if (cookies == null)
+            return false;
         for (int i = 0, len = cookies.length; i < len; i++)
         {
             if (findValue.equals(cookies[i]))
@@ -80,28 +83,32 @@
         return false;
     }
 
+    @Override
     public boolean isEmpty()
     {
         Cookie[] cookies = _httpServletRequest.getCookies();
         return cookies == null || cookies.length == 0;
     }
 
+    @Override
     public int size()
     {
         Cookie[] cookies = _httpServletRequest.getCookies();
         return cookies == null ? 0 : cookies.length;
     }
 
+    @Override
     public void putAll(Map t)
     {
         throw new UnsupportedOperationException();
     }
 
-
-    protected Object getAttribute(String key)
+    @Override
+    protected Cookie getAttribute(String key)
     {
         Cookie[] cookies = _httpServletRequest.getCookies();
-        if (cookies == null) return null;
+        if (cookies == null)
+            return null;
         for (int i = 0, len = cookies.length; i < len; i++)
         {
             if (cookies[i].getName().equals(key))
@@ -113,7 +120,7 @@
         return null;
     }
 
-    protected void setAttribute(String key, Object value)
+    protected void setAttribute(String key, Cookie value)
     {
         throw new UnsupportedOperationException(
             "Cannot set HttpRequest Cookies");
@@ -125,7 +132,7 @@
             "Cannot remove HttpRequest Cookies");
     }
 
-    protected Enumeration getAttributeNames()
+    protected Enumeration<String> getAttributeNames()
     {
         Cookie[] cookies = _httpServletRequest.getCookies();
 
@@ -133,7 +140,7 @@
   
     }
 
-    private static class CookieNameEnumeration implements Enumeration
+    private static class CookieNameEnumeration implements Enumeration<String>
     {
         private final Cookie[] _cookies;
         private final int _length;
@@ -150,8 +157,12 @@
             return _index < _length;
         }
 
-        public Object nextElement()
+        public String nextElement()
         {
+            if (!hasMoreElements())
+            {
+                throw new NoSuchElementException();
+            }
             return _cookies[_index++].getName();
         }
     }

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/InitParameterMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/InitParameterMap.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/InitParameterMap.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/InitParameterMap.java Tue Feb 27 13:20:10 2007
@@ -27,7 +27,7 @@
  * @author Anton Koinov (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class InitParameterMap extends AbstractAttributeMap
+public class InitParameterMap extends AbstractAttributeMap<String>
 {
     final ServletContext _servletContext;
 
@@ -36,12 +36,12 @@
         _servletContext = servletContext;
     }
 
-    protected Object getAttribute(String key)
+    protected String getAttribute(String key)
     {
         return _servletContext.getInitParameter(key);
     }
 
-    protected void setAttribute(String key, Object value)
+    protected void setAttribute(String key, String value)
     {
         throw new UnsupportedOperationException(
             "Cannot set ServletContext InitParameter");
@@ -53,7 +53,8 @@
             "Cannot remove ServletContext InitParameter");
     }
 
-    protected Enumeration getAttributeNames()
+    @SuppressWarnings("unchecked")
+    protected Enumeration<String> getAttributeNames()
     {
         return _servletContext.getInitParameterNames();
     }

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestHeaderMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestHeaderMap.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestHeaderMap.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestHeaderMap.java Tue Feb 27 13:20:10 2007
@@ -27,7 +27,7 @@
  * @author Anton Koinov (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class RequestHeaderMap extends AbstractAttributeMap
+public class RequestHeaderMap extends AbstractAttributeMap<String>
 {
     private final HttpServletRequest _httpServletRequest;
 
@@ -36,34 +36,41 @@
         _httpServletRequest = httpServletRequest;
     }
 
-    protected Object getAttribute(String key)
+    @Override
+    protected String getAttribute(String key)
     {
         return _httpServletRequest.getHeader(key);
     }
 
-    protected void setAttribute(String key, Object value)
+    @Override
+    protected void setAttribute(String key, String value)
     {
         throw new UnsupportedOperationException(
             "Cannot set HttpServletRequest Header");
     }
 
+    @Override
     protected void removeAttribute(String key)
     {
         throw new UnsupportedOperationException(
             "Cannot remove HttpServletRequest Header");
     }
 
-    protected Enumeration getAttributeNames()
+    @Override
+    @SuppressWarnings("unchecked")
+    protected Enumeration<String> getAttributeNames()
     {
         return _httpServletRequest.getHeaderNames();
     }
 
+    @Override
     public void putAll(Map t)
     {
         throw new UnsupportedOperationException();
     }
 
 
+    @Override
     public void clear()
     {
         throw new UnsupportedOperationException();

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestHeaderValuesMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestHeaderValuesMap.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestHeaderValuesMap.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestHeaderValuesMap.java Tue Feb 27 13:20:10 2007
@@ -23,55 +23,52 @@
 
 import javax.servlet.http.HttpServletRequest;
 
-
 /**
  * HttpServletRequest header values (multi-value headers) as Map of String[].
  * 
  * @author Anton Koinov (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class RequestHeaderValuesMap extends AbstractAttributeMap
+public class RequestHeaderValuesMap extends AbstractAttributeMap<String[]>
 {
     private final HttpServletRequest _httpServletRequest;
-    private final Map<String, Object>                _valueCache = new HashMap<String, Object>();
+    private final Map<String, String[]> _valueCache = new HashMap<String, String[]>();
 
     RequestHeaderValuesMap(HttpServletRequest httpServletRequest)
     {
         _httpServletRequest = httpServletRequest;
     }
 
-    protected Object getAttribute(String key)
+    protected String[] getAttribute(String key)
     {
-        Object ret = _valueCache.get(key);
+        String[] ret = _valueCache.get(key);
         if (ret == null)
         {
-            _valueCache.put(key, ret = toArray(_httpServletRequest
-                .getHeaders(key)));
+            _valueCache.put(key, ret = toArray(_httpServletRequest.getHeaders(key)));
         }
 
         return ret;
     }
 
-    protected void setAttribute(String key, Object value)
+    protected void setAttribute(String key, String[] value)
     {
-        throw new UnsupportedOperationException(
-            "Cannot set HttpServletRequest HeaderValues");
+        throw new UnsupportedOperationException("Cannot set HttpServletRequest HeaderValues");
     }
 
     protected void removeAttribute(String key)
     {
-        throw new UnsupportedOperationException(
-            "Cannot remove HttpServletRequest HeaderValues");
+        throw new UnsupportedOperationException("Cannot remove HttpServletRequest HeaderValues");
     }
 
-    protected Enumeration getAttributeNames()
+    @SuppressWarnings("unchecked")
+    protected Enumeration<String> getAttributeNames()
     {
         return _httpServletRequest.getHeaderNames();
     }
 
-    private String[] toArray(Enumeration e)
+    private String[] toArray(Enumeration<String> e)
     {
-        List ret = new ArrayList();
+        List<String> ret = new ArrayList<String>();
 
         while (e.hasMoreElements())
         {

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestMap.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestMap.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestMap.java Tue Feb 27 13:20:10 2007
@@ -27,7 +27,7 @@
  * @author Anton Koinov (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class RequestMap extends AbstractAttributeMap
+public class RequestMap extends AbstractAttributeMap<Object>
 {
     final ServletRequest _servletRequest;
 
@@ -36,32 +36,39 @@
         _servletRequest = servletRequest;
     }
 
+    @Override
     protected Object getAttribute(String key)
     {
         return _servletRequest.getAttribute(key);
     }
 
+    @Override
     protected void setAttribute(String key, Object value)
     {
         _servletRequest.setAttribute(key, value);
     }
 
+    @Override
     protected void removeAttribute(String key)
     {
         _servletRequest.removeAttribute(key);
     }
 
-    protected Enumeration getAttributeNames()
+    @Override
+    @SuppressWarnings("unchecked")
+    protected Enumeration<String> getAttributeNames()
     {
         return _servletRequest.getAttributeNames();
     }
 
+    @Override
     public void putAll(Map t)
     {
         throw new UnsupportedOperationException();
     }
 
 
+    @Override
     public void clear()
     {
         throw new UnsupportedOperationException();

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestParameterMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestParameterMap.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestParameterMap.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestParameterMap.java Tue Feb 27 13:20:10 2007
@@ -25,7 +25,7 @@
  * @author Anton Koinov (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class RequestParameterMap extends AbstractAttributeMap
+public class RequestParameterMap extends AbstractAttributeMap<String>
 {
     private final ServletRequest _servletRequest;
 
@@ -34,24 +34,29 @@
         _servletRequest = servletRequest;
     }
 
-    protected Object getAttribute(String key)
+    @Override
+    protected String getAttribute(String key)
     {
         return _servletRequest.getParameter(key);
     }
 
-    protected void setAttribute(String key, Object value)
+    @Override
+    protected void setAttribute(String key, String value)
     {
         throw new UnsupportedOperationException(
             "Cannot set ServletRequest Parameter");
     }
 
+    @Override
     protected void removeAttribute(String key)
     {
         throw new UnsupportedOperationException(
             "Cannot remove ServletRequest Parameter");
     }
 
-    protected Enumeration getAttributeNames()
+    @Override
+    @SuppressWarnings("unchecked")
+    protected Enumeration<String> getAttributeNames()
     {
         return _servletRequest.getParameterNames();
     }

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestParameterValuesMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestParameterValuesMap.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestParameterValuesMap.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/RequestParameterValuesMap.java Tue Feb 27 13:20:10 2007
@@ -25,7 +25,7 @@
  * @author Anton Koinov (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class RequestParameterValuesMap extends AbstractAttributeMap
+public class RequestParameterValuesMap extends AbstractAttributeMap<String[]>
 {
     private final ServletRequest _servletRequest;
 
@@ -34,24 +34,29 @@
         _servletRequest = servletRequest;
     }
 
-    protected Object getAttribute(String key)
+    @Override
+    protected String[] getAttribute(String key)
     {
         return _servletRequest.getParameterValues(key);
     }
 
-    protected void setAttribute(String key, Object value)
+    @Override
+    protected void setAttribute(String key, String[] value)
     {
         throw new UnsupportedOperationException(
             "Cannot set ServletRequest ParameterValues");
     }
 
+    @Override
     protected void removeAttribute(String key)
     {
         throw new UnsupportedOperationException(
             "Cannot remove ServletRequest ParameterValues");
     }
 
-    protected Enumeration getAttributeNames()
+    @Override
+    @SuppressWarnings("unchecked")
+    protected Enumeration<String> getAttributeNames()
     {
         return _servletRequest.getParameterNames();
     }

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/SessionMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/SessionMap.java?view=diff&rev=512415&r1=512414&r2=512415
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/SessionMap.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/context/servlet/SessionMap.java Tue Feb 27 13:20:10 2007
@@ -30,7 +30,7 @@
  * @author Anton Koinov (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class SessionMap extends AbstractAttributeMap
+public class SessionMap extends AbstractAttributeMap<Object>
 {
     private final HttpServletRequest _httpRequest;
 
@@ -39,18 +39,20 @@
         _httpRequest = httpRequest;
     }
 
+    @Override
     protected Object getAttribute(String key)
     {
         HttpSession httpSession = getSession();
-        return (httpSession == null)
-            ? null : httpSession.getAttribute(key.toString());
+        return (httpSession == null) ? null : httpSession.getAttribute(key.toString());
     }
 
+    @Override
     protected void setAttribute(String key, Object value)
     {
         _httpRequest.getSession(true).setAttribute(key, value);
     }
 
+    @Override
     protected void removeAttribute(String key)
     {
         HttpSession httpSession = getSession();
@@ -60,12 +62,12 @@
         }
     }
 
-    protected Enumeration getAttributeNames()
+    @Override
+    @SuppressWarnings("unchecked")
+    protected Enumeration<String> getAttributeNames()
     {
         HttpSession httpSession = getSession();
-        return (httpSession == null)
-            ? NullEnumeration.instance()
-            : httpSession.getAttributeNames();
+        return (httpSession == null) ? NullEnumeration.instance() : httpSession.getAttributeNames();
     }
 
     private HttpSession getSession()
@@ -73,23 +75,24 @@
         return _httpRequest.getSession(false);
     }
 
-
+    @Override
     public void putAll(Map t)
     {
         throw new UnsupportedOperationException();
     }
 
     /**
-     * This will clear the session without invalidation.  If no session has
-     * been created, it will simply return.
+     * This will clear the session without invalidation. If no session has been created, it will simply return.
      */
+    @Override
     public void clear()
     {
         HttpSession session = getSession();
-        if (session == null) return;
-        for (Enumeration attributeNames = session.getAttributeNames(); 
-             attributeNames.hasMoreElements(); ) {
-            String attributeName = (String)attributeNames.nextElement();
+        if (session == null)
+            return;
+        for (Enumeration attributeNames = session.getAttributeNames(); attributeNames.hasMoreElements();)
+        {
+            String attributeName = (String) attributeNames.nextElement();
             session.removeAttribute(attributeName);
         }
     }



Mime
View raw message