Tapestry's URLEncoder should probably be deprecated.

It was an attempt to smooth the differences between Tomcat and Jetty,
where they did different things w.r.t. URLDecoding.  I honestly can't
remember which did which, but basically one would decode the path and
query parameters automatically, and one expected that to be done in
user code.

A better approach would be for Tapestry to do it automatically, and
short-circuit the logic if the servlet container does the work,
possibly though a configuration symbol, possibly initialized smartly
based on detecting which servlet container is being used (this can
possibly be determined via the stack trace).

On Mon, Jan 16, 2012 at 9:44 AM, Lenny Primak <lpri...@hope.nyc.ny.us> wrote:
> Tapestry's URLEncoder isn't the best implementation, I agree.
> But the bug that you are referring to was indeed fixed.
> As Thiago *just* answered, your solution would probably be
> to put in your own URLencoder.
> Also, you can open up a new JIRA issue about Tapestry's URLencoder
> now adhering to the W3C Standards.
>
> On Jan 16, 2012, at 12:21 PM, Jochen Frey wrote:
>
>> I see what you're saying, you are using Tapestry's URLEncoder.  When I do 
>> that, j...@gmail.com becomes: joe$0040gmail.com
>>
>> When I pass that like this: /thanks?email=joe$0040gmail.com it indeed works.
>>
>> Unfortunately (for me), I get this parameter passed from non-Tapestry code, 
>> and the rest of the internet uses %-encoding 
>> (http://tools.ietf.org/html/rfc3986#section-2), which makes this a problem 
>> for me, especially since this seems to be one of the few places where 
>> Tapestry gives me no way to intercept this behavior (typically Tapestry is 
>> GREAT about that).
>>
>> I *think* that the bug report 
>> (https://issues.apache.org/jira/browse/TAP5-1768) that his had been 
>> addressed in TS 5.3.1, but it still doesn't seem to work.
>>
>> Maybe I am posting to the wrong list?
>>
>> Thanks!
>> Jochen
>>
>>
>> On Jan 16, 2012, at 8:52 AM, Lenny Primak wrote:
>>
>>> I do the same thing (but have embedded slashes (/) instead of the '@' sign)
>>> and it works perfectly.
>>>
>>> On Jan 16, 2012, at 11:47 AM, Jochen Frey wrote:
>>>
>>>> That's exactly what I did (see my example below where I show the encoded 
>>>> parameter), which is why the email is sent as: 
>>>> /thanks?email=joe%40gmail.com (and not as j...@gmail.com), but it still 
>>>> breaks.
>>>>
>>>> It looks to me like https://issues.apache.org/jira/browse/TAP5-1768 may 
>>>> not be fixed (or not fixed correctly) in TS 5.3.1?
>>>>
>>>> Any help appreciated!
>>>> Jochen
>>>>
>>>> On Jan 16, 2012, at 6:18 AM, Lenny Primak wrote:
>>>>
>>>>> The query parameter needs to b e URLencoded otherwise it won't pass 
>>>>> validation, which is exactly what happens in your code. Use 
>>>>> URLencoder.encode() or similar.
>>>>>
>>>>>
>>>>>
>>>>> On Jan 16, 2012, at 12:23 AM, Jochen Frey <joc...@jochenfrey.com> wrote:
>>>>>
>>>>>> Hi!
>>>>>>
>>>>>> I am using a form to get e-mail signups into salesforce.com.  This 
>>>>>> mechanism requires to pass a callback URL which salesforce redirects the 
>>>>>> browser to on completion of the action.  I want this callback to have 
>>>>>> the signup email as a query parameter:
>>>>>>
>>>>>> ... /thanks?email=joe%40gmail.com
>>>>>>
>>>>>> Hence in the receiving page I have an @ActivationRequestParameter
>>>>>>
>>>>>>
>>>>>> public class Thanks {
>>>>>> @ActivationRequestParameter
>>>>>> @Property
>>>>>> private String email;
>>>>>>
>>>>>>
>>>>>> When I do this, I get ComponentEventException:
>>>>>> org.apache.tapestry5.runtime.ComponentEventException
>>>>>> Input string 'j...@gmail.com' is not valid; the character '@' at 
>>>>>> position 4 is not valid.
>>>>>> ...
>>>>>>
>>>>>>
>>>>>> Stacktrace:
>>>>>> Stack trace
>>>>>> org.apache.tapestry5.internal.services.URLEncoderImpl.decode(URLEncoderImpl.java:144)
>>>>>> org.apache.tapestry5.internal.transform.ActivationRequestParameterWorker$2.handleEvent(ActivationRequestParameterWorker.java:128)
>>>>>> org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl$TransformationSupportImpl$1$1.invoke(ComponentInstantiatorSourceImpl.java:443)
>>>>>> org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl$TransformationSupportImpl$1.advise(ComponentInstantiatorSourceImpl.java:439)
>>>>>> org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:86)
>>>>>>
>>>>>> Am I doing something wrong, or is the the same bug as mentioned here: 
>>>>>> https://issues.apache.org/jira/browse/TAP5-1768
>>>>>>
>>>>>> I am using TS 5.3.1.  Suggestions welcome!
>>>>>>
>>>>>> Thanks!!!
>>>>>> Jochen
>>>>>>
>>>>>> ---
>>>>>> joc...@jochenfrey.com
>>>>>> +1.415.366.0450
>>>>>> @jochen_frey
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>>>
>>>>
>>>>
>>>> ---
>>>> joc...@jochenfrey.com
>>>> +1.415.366.0450
>>>> @jochen_frey
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>
>>
>> ---
>>  joc...@jochenfrey.com
>>  +1.415.366.0450
>>  @jochen_frey
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to