[ http://issues.apache.org/jira/browse/TAPESTRY-280?page=all ] Howard M. Lewis Ship resolved TAPESTRY-280: -------------------------------------------
Resolution: Invalid Assign To: Howard M. Lewis Ship Haven't seen any updates to this bug, so I'm marking it as invalid. > DataSqueezer should URLEncode/Decode its string > ----------------------------------------------- > > Key: TAPESTRY-280 > URL: http://issues.apache.org/jira/browse/TAPESTRY-280 > Project: Tapestry > Type: Bug > Components: Framework > Versions: 3.0.1, 3.0, 3.0.2 > Environment: Java AMD64 1.5.01 > Reporter: Mikaƫl Cluseau > Assignee: Howard M. Lewis Ship > > I would add a fix in the DataSqueezer: the current implementation allow > Strings like "abc&sp=def" directly in the URL, which creates a second > parameter where only one is expected. > This is very inconvenient when you squeeze callback URLs (I have a > RedirectCallback that squeezes to R{url}). The bug is not obvious (I > first tought the browser was "pretty printing" the URL) as the "?" is > not considered a parameter so, if you have > Login.tap?sp=R/List.tap?sp=1&sp=2, the callback's URL becomes > "/List.tap?sp=1" and you have a second parameter to your Login page... > I think the correct way of encoding parameters is : > ... > // TODO For Java 1.3 compatibility, use equivalents from commons-codecs > import java.net.URLEncoder; > import java.net.URLDecoder; > ... > public class DataSqueezer { > ... > public String squeeze(Object data) throws IOException > { > ISqueezeAdaptor adaptor; > if (data == null) > return NULL_PREFIX; > adaptor = (ISqueezeAdaptor) _adaptors.getAdaptor(data.getClass()); > return URLEncoder.encode(adaptor.squeeze(this, data),"UTF-8"); > } > ... > public Object unsqueeze(String rawString) throws IOException > { > ISqueezeAdaptor adaptor = null; > String string = URLDecoder.decode(rawString, "UTF-8"); > if (string.equals(NULL_PREFIX)) > return null; > int offset = string.charAt(0) - FIRST_ADAPTOR_OFFSET; > if (offset >= 0 && offset < _adaptorByPrefix.length) > adaptor = _adaptorByPrefix[offset]; > // If the adaptor is not otherwise recognized, the it is simply > // an encoded String (the StringAdaptor may not have added > // a prefix). > if (adaptor == null) > return string; > // Adaptor should never be null, because we always supply > // an adaptor for String > return adaptor.unsqueeze(this, string); > } > ... > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]