You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Fuad Efendi <fu...@efendi.ca> on 2007/02/05 04:48:12 UTC

URI decoding problem

I can't understand why Cocoon/Tomcat cand't properly decode such URLs:

.../CD%20%2B%20DVD%20Drives/


URL: CD + DVD Drives
Encode-for-uri: CD%20%2B%20DVD%20Drives


RE: URI decoding problem

Posted by Fuad Efendi <fu...@efendi.ca>.
Sorry for typo: .replaceAll("\\+","%2B")

>I use java.lang.String(...).replaceAll("+","%2B") before
>forwarding request to another pipeline...


RE: URI decoding problem

Posted by Fuad Efendi <fu...@efendi.ca>.
Thanks Alex,


Latest news:

1. I don't have any problem when I access Tomcat (Cocoon) directly.
2. I have problems only when I access Cocoon via Apache HTTPD front-end.


By somehow, HTTPD converts user's request /CD%20%2B%20DVD/ into
/CD%20+%20DVD/. Of cource, Tomcat (and Cocoon) misunderstands it as
/CD+++DVD/, or /CD   DVD/

It's most probably bug in AJP/1.3, not related to Cocoon...

As a workaround, I use java.lang.String(...).replaceAll("+","%2B") before
forwarding request to another pipeline...





-----Original Message-----
From: Alexander Klimetschek [mailto:alexander.klimetschek@mindquarry.com] 
Sent: Monday, February 05, 2007 4:08 AM
To: dev@cocoon.apache.org
Subject: Re: URI decoding problem


Fuad Efendi schrieb:
> API Docs are probably with typo:
>  * &lt;map:generate
>
src="http://remote/page?param1={url-encode:{request-param:param1}}"/&gt;<br/
> 
> public final class URLDecodeModule extends AbstractInputModule
>                                    implements ThreadSafe {
> 
> 
> {url-decode:...}? instead of url-encode?
> 
> 

Depends on what you are doing. The example above
(http://remote/page?param1={url-encode:{request-param:param1}}) makes a http
call from inside Cocoon and uses a parameter of the original request 
"{request-param:param1}". This request parameter is already decoded,
depending on the standard encoding of the servlet container and Cocoon's
encoding settings:

org.apache.cocoon.containerencoding=utf-8
org.apache.cocoon.formencoding=utf-8

(Default value is actually ISO-8859-1, for more information see [1])

For the new request those have to be re-encoded again, that's why there is
"{url-encode:....}" in the example.

If you don't get correctly decoded request parameters, try to set those
encoding properties, the mentioned wiki page should help).


Alex

[1] http://wiki.apache.org/cocoon/RequestParameterEncoding

-- 
Alexander Klimetschek
http://www.mindquarry.com




Re: URI decoding problem

Posted by Alexander Klimetschek <al...@mindquarry.com>.
Fuad Efendi schrieb:
> API Docs are probably with typo:
>  * &lt;map:generate
> src="http://remote/page?param1={url-encode:{request-param:param1}}"/&gt;<br/
> 
> public final class URLDecodeModule extends AbstractInputModule
>                                    implements ThreadSafe {
> 
> 
> {url-decode:...}? instead of url-encode?
> 
> 

Depends on what you are doing. The example above (http://remote/page?param1={url-encode:{request-param:param1}}) makes a http call from inside Cocoon and uses a parameter of the original request 
"{request-param:param1}". This request parameter is already decoded, depending on the standard encoding of the servlet container and Cocoon's encoding settings:

org.apache.cocoon.containerencoding=utf-8
org.apache.cocoon.formencoding=utf-8

(Default value is actually ISO-8859-1, for more information see [1])

For the new request those have to be re-encoded again, that's why there is "{url-encode:....}" in the example.

If you don't get correctly decoded request parameters, try to set those encoding properties, the mentioned wiki page should help).


Alex

[1] http://wiki.apache.org/cocoon/RequestParameterEncoding

-- 
Alexander Klimetschek
http://www.mindquarry.com


RE: URI decoding problem

Posted by Fuad Efendi <fu...@efendi.ca>.
API Docs are probably with typo:
 * &lt;map:generate
src="http://remote/page?param1={url-encode:{request-param:param1}}"/&gt;<br/
>

public final class URLDecodeModule extends AbstractInputModule
                                   implements ThreadSafe {


{url-decode:...}? instead of url-encode?


RE: URI decoding problem

Posted by Fuad Efendi <fu...@efendi.ca>.
I found link
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/components/modules/in
put/URLDecodeModule.html
Thanks

-----Original Message-----
From: Fuad Efendi


I can't understand why Cocoon/Tomcat cand't properly decode such URLs:

.../CD%20%2B%20DVD%20Drives/


URL: CD + DVD Drives
Encode-for-uri: CD%20%2B%20DVD%20Drives