Quantcast

IPageParametersEncoder

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

IPageParametersEncoder

Sven Meier
Anybody knows the reason why IPageParametersEncoder's methods are
asymetrical:

     Url encodePageParameters(PageParameters pageParameters);
     PageParameters decodePageParameters(Request request);

Shouldn't that be:

     Url encodePageParameters(PageParameters pageParameters);
     PageParameters decodePageParameters(Url url);

Any objections changing that?

Sven
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: IPageParametersEncoder

Martin Grigorov-4
Hi,

I think it works with Request to be able to get the POST parameters.
Since 1.5.4 (https://issues.apache.org/jira/browse/WICKET-4338) we put
the POST parameters in PageParameters.
Recently we found that these POST params may be encoded in some
conditions in the Url:
https://issues.apache.org/jira/browse/WICKET-4400?focusedCommentId=13204513&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13204513
Yesterday Emond also faced this behavior.

Now the questions is: is PageParameters only for GET parameters.
Looking at its javadoc - yes. Then 4338 should be reverted and explain
the users that they have to use getRequest().getRequestParameters()
instead of PageParameters if they need the POST params.

The other solution is to leave Request in IPageParametersEncoder so it
can decode POST and make PageParameters smarter to know which params
are GET and which POST and return just the GET ones in
IPageParametersEncoder#encodePageParameters().

On Thu, Feb 23, 2012 at 8:07 AM, Sven Meier <[hidden email]> wrote:

> Anybody knows the reason why IPageParametersEncoder's methods are
> asymetrical:
>
>    Url encodePageParameters(PageParameters pageParameters);
>    PageParameters decodePageParameters(Request request);
>
> Shouldn't that be:
>
>    Url encodePageParameters(PageParameters pageParameters);
>    PageParameters decodePageParameters(Url url);
>
> Any objections changing that?
>
> Sven



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: IPageParametersEncoder

Sven Meier
Page parameters are for GET parameters only, which is obvious in the
following signature:

        Url encodePageParameters(PageParameters pageParameters);

IMHO WICKET-4338 should be reverted.

Sven


Am 23.02.2012 08:45, schrieb Martin Grigorov:

> Hi,
>
> I think it works with Request to be able to get the POST parameters.
> Since 1.5.4 (https://issues.apache.org/jira/browse/WICKET-4338) we put
> the POST parameters in PageParameters.
> Recently we found that these POST params may be encoded in some
> conditions in the Url:
> https://issues.apache.org/jira/browse/WICKET-4400?focusedCommentId=13204513&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13204513
> Yesterday Emond also faced this behavior.
>
> Now the questions is: is PageParameters only for GET parameters.
> Looking at its javadoc - yes. Then 4338 should be reverted and explain
> the users that they have to use getRequest().getRequestParameters()
> instead of PageParameters if they need the POST params.
>
> The other solution is to leave Request in IPageParametersEncoder so it
> can decode POST and make PageParameters smarter to know which params
> are GET and which POST and return just the GET ones in
> IPageParametersEncoder#encodePageParameters().
>
> On Thu, Feb 23, 2012 at 8:07 AM, Sven Meier<[hidden email]>  wrote:
>> Anybody knows the reason why IPageParametersEncoder's methods are
>> asymetrical:
>>
>>     Url encodePageParameters(PageParameters pageParameters);
>>     PageParameters decodePageParameters(Request request);
>>
>> Shouldn't that be:
>>
>>     Url encodePageParameters(PageParameters pageParameters);
>>     PageParameters decodePageParameters(Url url);
>>
>> Any objections changing that?
>>
>> Sven
>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: IPageParametersEncoder

Martin Grigorov-4
On Thu, Feb 23, 2012 at 9:30 AM, Sven Meier <[hidden email]> wrote:
> Page parameters are for GET parameters only, which is obvious in the
> following signature:
>
>        Url encodePageParameters(PageParameters pageParameters);
>
> IMHO WICKET-4338 should be reverted.

Revert it.
Change the API in 6.0.
We can create a new IPageParametersEncoder that reads the POST params
from RequestCycle.get().getRequest().... but the users should
explicitly use it in WebApplication#mount() and know that this may
lead to the leak POST params in the url.

>
> Sven
>
>
> Am 23.02.2012 08:45, schrieb Martin Grigorov:
>
>> Hi,
>>
>> I think it works with Request to be able to get the POST parameters.
>> Since 1.5.4 (https://issues.apache.org/jira/browse/WICKET-4338) we put
>> the POST parameters in PageParameters.
>> Recently we found that these POST params may be encoded in some
>> conditions in the Url:
>>
>> https://issues.apache.org/jira/browse/WICKET-4400?focusedCommentId=13204513&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13204513
>> Yesterday Emond also faced this behavior.
>>
>> Now the questions is: is PageParameters only for GET parameters.
>> Looking at its javadoc - yes. Then 4338 should be reverted and explain
>> the users that they have to use getRequest().getRequestParameters()
>> instead of PageParameters if they need the POST params.
>>
>> The other solution is to leave Request in IPageParametersEncoder so it
>> can decode POST and make PageParameters smarter to know which params
>> are GET and which POST and return just the GET ones in
>> IPageParametersEncoder#encodePageParameters().
>>
>> On Thu, Feb 23, 2012 at 8:07 AM, Sven Meier<[hidden email]>  wrote:
>>>
>>> Anybody knows the reason why IPageParametersEncoder's methods are
>>> asymetrical:
>>>
>>>    Url encodePageParameters(PageParameters pageParameters);
>>>    PageParameters decodePageParameters(Request request);
>>>
>>> Shouldn't that be:
>>>
>>>    Url encodePageParameters(PageParameters pageParameters);
>>>    PageParameters decodePageParameters(Url url);
>>>
>>> Any objections changing that?
>>>
>>> Sven
>>
>>
>>
>



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
Loading...