You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Patrick Antivackis <pa...@gmail.com> on 2009/06/17 21:39:36 UTC

Url encoding for get parameters

Hello,
Before filling a bug i would like to confirm it with you and validating the
way to correct it.

Let's say I want to create a new category which ID is  DVD+R
Creation is ok through the admin interface, but whenever i want to access
this category, the get parameter categoryId=.... of the url is wrong as it's
not encoded, so we have :
https://localhost:8443/catalog/control/EditCategory?productCategoryId=DVD+Rinstead
of
https://localhost:8443/catalog/control/EditCategory?productCategoryId=DVD%2BR
I take a category example, but it can apply to product, party, .... well all
entities.
In the freemarker templates, the urls usually look like this :
<a
href="<@o...@ofbizUrl>">
so is it the ofbizUrl that is not doing it's job, or should the url be :
<a
href="<@o...@ofbizUrl>">

Thank you in advance for your answer

Re: Url encoding for get parameters

Posted by Patrick Antivackis <pa...@gmail.com>.
After digging deeper, the widget are also buggy.as the function
buildhyperlinkUrl in
framework/widget/src/org/ofbiz/widget/WidgetWorker.java
is not using url encoding either.

I found that the StringUtil.defaultWebEncoder.encodeForURL shoudl do the
job, but i would like a core developper to have a look to it as the bug is
really central so i would prefer not to create side effects.


2009/6/17 Patrick Antivackis <pa...@gmail.com>

> So after looking into :
> framework/webapp/src/org/ofbiz/webapp/ftl/OfbizUrlTransform.java
> and
> framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java
> the ofbizUrl tag is calling the RequestHandler.makeLink which is using
> httpServletResponse.encodeUrl.
> So parameters are not url encoded, as contrary to the name
> httpServletResponse.encodeUrl is not doing an encoding job of the
> parameters.
>
> So back to my initial question, should the ofbizUrl do this url enconding
> of the params or should we use the freemarker ?url string function ?
>
>
>
> 2009/6/17 Patrick Antivackis <pa...@gmail.com>
>
>> in fact in the source there is
>>
>> <a href="https://localhost:8443/catalog/control/EditCategory?productCategoryId=DVD&#43;r <https://localhost:8443/catalog/control/EditCategory?productCategoryId=DVD+r>">
>>
>>
>> which is really stupid !! as it means 2 parameters.
>> So the ofbizUrl tag is encoding, but i don't understand why it's encoding like this.
>>
>>
>>
>> 2009/6/17 Patrick Antivackis <pa...@gmail.com>
>>
>> Hello,
>>> Before filling a bug i would like to confirm it with you and validating
>>> the way to correct it.
>>>
>>> Let's say I want to create a new category which ID is  DVD+R
>>> Creation is ok through the admin interface, but whenever i want to access
>>> this category, the get parameter categoryId=.... of the url is wrong as it's
>>> not encoded, so we have :
>>>
>>> https://localhost:8443/catalog/control/EditCategory?productCategoryId=DVD+Rinstead of
>>>
>>> https://localhost:8443/catalog/control/EditCategory?productCategoryId=DVD%2BR
>>> I take a category example, but it can apply to product, party, .... well
>>> all entities.
>>> In the freemarker templates, the urls usually look like this :
>>> <a
>>> href="<@o...@ofbizUrl>">
>>> so is it the ofbizUrl that is not doing it's job, or should the url be :
>>> <a
>>> href="<@o...@ofbizUrl>">
>>>
>>> Thank you in advance for your answer
>>>
>>>
>>>
>>>
>>
>

Re: Url encoding for get parameters

Posted by Patrick Antivackis <pa...@gmail.com>.
So after looking into :
framework/webapp/src/org/ofbiz/webapp/ftl/OfbizUrlTransform.java
and
framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java
the ofbizUrl tag is calling the RequestHandler.makeLink which is using
httpServletResponse.encodeUrl.
So parameters are not url encoded, as contrary to the name
httpServletResponse.encodeUrl is not doing an encoding job of the
parameters.

So back to my initial question, should the ofbizUrl do this url enconding of
the params or should we use the freemarker ?url string function ?


2009/6/17 Patrick Antivackis <pa...@gmail.com>

> in fact in the source there is
>
> <a href="https://localhost:8443/catalog/control/EditCategory?productCategoryId=DVD&#43;r <https://localhost:8443/catalog/control/EditCategory?productCategoryId=DVD+r>">
>
> which is really stupid !! as it means 2 parameters.
> So the ofbizUrl tag is encoding, but i don't understand why it's encoding like this.
>
>
>
> 2009/6/17 Patrick Antivackis <pa...@gmail.com>
>
> Hello,
>> Before filling a bug i would like to confirm it with you and validating
>> the way to correct it.
>>
>> Let's say I want to create a new category which ID is  DVD+R
>> Creation is ok through the admin interface, but whenever i want to access
>> this category, the get parameter categoryId=.... of the url is wrong as it's
>> not encoded, so we have :
>>
>> https://localhost:8443/catalog/control/EditCategory?productCategoryId=DVD+Rinstead of
>>
>> https://localhost:8443/catalog/control/EditCategory?productCategoryId=DVD%2BR
>> I take a category example, but it can apply to product, party, .... well
>> all entities.
>> In the freemarker templates, the urls usually look like this :
>> <a
>> href="<@o...@ofbizUrl>">
>> so is it the ofbizUrl that is not doing it's job, or should the url be :
>> <a
>> href="<@o...@ofbizUrl>">
>>
>> Thank you in advance for your answer
>>
>>
>>
>>
>

Re: Url encoding for get parameters

Posted by Patrick Antivackis <pa...@gmail.com>.
in fact in the source there is

<a href="https://localhost:8443/catalog/control/EditCategory?productCategoryId=DVD&#43;r">
which is really stupid !! as it means 2 parameters.
So the ofbizUrl tag is encoding, but i don't understand why it's
encoding like this.



2009/6/17 Patrick Antivackis <pa...@gmail.com>

> Hello,
> Before filling a bug i would like to confirm it with you and validating the
> way to correct it.
>
> Let's say I want to create a new category which ID is  DVD+R
> Creation is ok through the admin interface, but whenever i want to access
> this category, the get parameter categoryId=.... of the url is wrong as it's
> not encoded, so we have :
> https://localhost:8443/catalog/control/EditCategory?productCategoryId=DVD+Rinstead of
>
> https://localhost:8443/catalog/control/EditCategory?productCategoryId=DVD%2BR
> I take a category example, but it can apply to product, party, .... well
> all entities.
> In the freemarker templates, the urls usually look like this :
> <a
> href="<@o...@ofbizUrl>">
> so is it the ofbizUrl that is not doing it's job, or should the url be :
> <a
> href="<@o...@ofbizUrl>">
>
> Thank you in advance for your answer
>
>
>
>