Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /* 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.myfaces.portlet.faces.util.map;
 
 import java.util.List;
 import java.util.Map;
 
 
Map of portlet request params
 
 {
   private final PortletRequest mPortletRequest;
   private final Map<StringStringmInternalAttributes;
 
   public PortletRequestParameterMap(Object requestMap<StringStringinternal)
   {
     if (request instanceof PortletRequest)
     {
        = (PortletRequestrequest;
       if (internal == null)
       {
          = Collections.emptyMap();
       }
       else
       {
          = new HashMap(internal);;
       }
     }
     else
     {
       throw new IllegalArgumentException();
     }
   }
 
   @Override
   public String getAttribute(String key)
   {
     if ( != null)
     {  
       if ( == null
       {
       }
       String[] params = .get(key);
       if (params != null)
       {
         return params[0];
       }
       else 
       // Now try the internal/temp parameters (part of the views querystring)
       {
         return .get(key);
       }
       
     }
     else
     {
       throw new IllegalArgumentException();
     }
   }
 
   @Override
   public void setAttribute(String keyString value)
   {
     throw new UnsupportedOperationException();
   }
 
   @Override
   public void removeAttribute(String key)
   {
     throw new UnsupportedOperationException();
   }
  @SuppressWarnings("unchecked")
  {
    if ( != null)
    {    
      // merged list of internal parameters & request parameters
      List<StringattrNames = new ArrayList<String>(5);
      if ( == null
      {
      }
      attrNames.addAll(.keySet());
      attrNames.addAll(.keySet());
      return Collections.enumeration(attrNames);
    }
    else
    {
    }
  }
  
  {
    // Some portlet containers (WebSphere) claim submitted (form) data aren't private parameters 
    // during an action/resource request -- instead they are all regular params -- to workaround
    // this indicate that during an action/resource all non-public params are private params
    
    Map <StringString[]> privateParams = .getPrivateParameterMap();;
    if ((BridgeUtil.getPortletRequestPhase() == .. || 
         BridgeUtil.getPortletRequestPhase() == ..))
    {
      Map<StringString[]> allParams = .getParameterMap();
      Map<StringString[]> publicParams = .getPublicParameterMap();
    
      if (publicParams.size() == 0)
      {
        privateParams = allParams;
      }
      else if (allParams.size() != (privateParams.size() + publicParams.size()))
      {
        // Construct the non-Public param Map by excluding those which are public
        // from the overall set.  This works around issue that some portlet
        // containers think getPrivateParameters should return the private
        // render parameters -- and hence its empty during an action. (WebSphere 6.1 is one case)
        privateParams = (Map<StringString[]>) new HashMap(allParams);
        for (Map.Entry<StringString[]> entry :  publicParams.entrySet())
        {
          privateParams.remove(entry.getKey());
        }
      }
    }
    
    return privateParams;
  }
New to GrepCode? Check out our FAQ X