[jboss-user] [JBoss Seam] - Re: Encoded Request Parameter

chane do-not-reply at jboss.com
Wed Dec 13 00:15:28 EST 2006


This is the link I am using:

 http://somedomain.com/action.seam?param1=v1&param2=v2

For some reason it seams that the browser encodes the link to use "&" instead of just "&".

I figured this is probably a JSF/Tomcat issue; but it seems like for the short term I can solve it in Seam.  I modified Component like this:


  | 
  |    private Object convertMultiValueRequestParameter(Map<String, String[]> requestParameters, String name, Class<?> type)
  |    {
  |       String[] array = requestParameters.get(name);
  |       
  |       if(array == null || array.length==0){
  |          array = requestParameters.get("amp;"+name);
  |       }
  |       
  |       if (array==null || array.length==0)
  |       {
  |          return null;
  |       }
  |       else
  |       {
  |          if ( type.isArray() )
  |          {
  |                int length = Array.getLength(array);
  |                Class<?> elementType = type.getComponentType();
  |                Object newInstance = Array.newInstance(elementType, length);
  |                for ( int i=0; i<length; i++ )
  |                {
  |                   Object element = convertRequestParameter( (String) Array.get(array, i), elementType );
  |                   Array.set( newInstance, i, element );
  |                }
  |                return newInstance;
  |          }
  |          else
  |          {
  |             return convertRequestParameter( array[0], type );
  |          }
  |       }
  |    }

So when a RequestParameter is searched for, if it is not found the "amp;"+name version is looked for next.  I don't like this solution; but for the short term it's gonna have to suffice.  Other suggestions are always welcomed.

As for Seam 1.1, I am looking forward to using it as soon as I can; but I can't move to the new version right this instant.  We are planning on moving to 1.1 in the next couple of months (maybe over xmas) when I have a chance to do some testing.  I also need to look into making some of my local modifications to the 1.1 version (specifically - http://jira.jboss.org/jira/browse/JBSEAM-326).  None of them are difficult, just need some time.

Thanks,
Chris....

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993245#3993245

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993245



More information about the jboss-user mailing list