[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-791) Restful paramameter values are not URL encoded

John Ray (JIRA) jira-events at jboss.com
Wed Feb 7 17:28:30 EST 2007


Restful paramameter values are not URL encoded
----------------------------------------------

                 Key: JBSEAM-791
                 URL: http://jira.jboss.com/jira/browse/JBSEAM-791
             Project: JBoss Seam
          Issue Type: Bug
         Environment: Latest seam from CVS
            Reporter: John Ray


I have an application that using restful URLs like the blog example. The problem is that the parameter values are not URL encoded. So if a user does a search for "books+records" then the url ends up being

  /search.seam?searchPattern=books+records

After the redirect the plus ends up being decoded to a space and you end up searching for "books records". The correct URL should be 

  /search.seam?searchPattern=books%2Brecords

The problem is in org.jboss.seam.core.Manager.encodeParameters()

Line 902 - builder.append(value);
Needs to be changed to something like 
                  try {
                     builder.append(URLEncoder.encode(String.valueOf(value),"UTF-8"));
                  }
                  catch (UnsupportedEncodingException e)
                  {
                     // This should never happen because we hard coded the encoding to UTF-8
                     throw new RuntimeException(e);
                  }

Line 913 - builder.append(parameterValue);
Needs to be changed to something like 
               try {
                  builder.append(URLEncoder.encode(String.valueOf(parameterValue),"UTF-8"));
               }
               catch (UnsupportedEncodingException e)
               {
                  // This should never happen because we hard coded the encoding to UTF-8
                  throw new RuntimeException(e);
               }

If I make the above 2 changes then everything works fine for me.

It also seems that the encodeConversationId() method would have a similar problem if an explicit conversation id was used that has characters that should be URL encoded.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list