You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Robin Wyles <ro...@robinwyles.com> on 2008/05/06 13:03:16 UTC
SSF and URL Encoding
Hi All,
Consider this pipeline matcher:
<map:match pattern="xq/*/-/**">
<map:generate type="servletService" src="cocoon:/list-
category-tag.xq">
<map:parameter name="service"
value="servlet:exist:/db/feeds/{1}/entries?terms={2}"/>
</map:generate>
<map:serialize type="xml"/>
</map:match>
... when called using the following URL...
/xq/testfeed/-/one%7Ctwo
... results in the following exception...
java.net.MalformedURLException: Invalid URI syntax. Illegal
character in opaque part at index 74: servlet:exist:/db/feeds/
testfeed/entries?terms=one|two
at
org.apache.cocoon.servletservice.components.ServletSource.createServletC
onnection(ServletSource.java:142)
[...]
So, my questions are
a) Should ServletSource be encoding the URL it receives ? I would've
thought probably not...
a) How can I re-encode the part of the URL I am passing as a request
param to my servlet service call within the sitemap?
Many thanks,
Robin
Re: SSF and URL Encoding
Posted by Robin Wyles <ro...@robinwyles.com>.
Hi Rainer,
Thanks very much for your reply... shortly after writing my post I
thought about using an input module, and wrote my own url encoding
input module, not realising there was one already included with
Cocoon - after all these years using Cocoon I've never seen it!
However, I'm under the impression that input modules will be replaced
by the expression languages at some point [1]... Perhaps someone else
might care to comment how this may be achieved in the new C2.2 way.
Robin
[1] http://cocoon.apache.org/2.2/core-modules/expression-language-
impl/1.0/1407_1_1.html
On 6 May 2008, at 12:59, Rainer Pruy wrote:
> Hi Robin
>
> Robin Wyles schrieb:
>> Hi All,
>> [...]
>>
>> So, my questions are
>>
>> a) Should ServletSource be encoding the URL it receives ? I would've
>> thought probably not...
>
> just my personal opinion: No. It would cause SSF to treat URLs
> different from other protocols.
> matching happens on de-coded URLS. Thus it is quite natural to
> expect some special treatment being necessary for matched strings when
> being used as part of newly built URLs.
>>
>> a) How can I re-encode the part of the URL I am passing as a request
>> param to my servlet service call within the sitemap?
>
> You can use url-encode module. in your example, probably:
>
> <map:parameter name="service"
> value="servlet:exist:/db/feeds/{url-encode:{1}}/entries?
> terms={url-encode:{2}}"/>
>
>
>>
>> Many thanks,
>>
>> Robin
>
> Rainer
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
Re: SSF and URL Encoding
Posted by Rainer Pruy <Ra...@Acrys.COM>.
Hi Robin
Robin Wyles schrieb:
> Hi All,
> [...]
>
> So, my questions are
>
> a) Should ServletSource be encoding the URL it receives ? I would've
> thought probably not...
just my personal opinion: No. It would cause SSF to treat URLs different from other protocols.
matching happens on de-coded URLS. Thus it is quite natural to expect some special treatment being necessary for matched strings when
being used as part of newly built URLs.
>
> a) How can I re-encode the part of the URL I am passing as a request
> param to my servlet service call within the sitemap?
You can use url-encode module. in your example, probably:
<map:parameter name="service"
value="servlet:exist:/db/feeds/{url-encode:{1}}/entries?terms={url-encode:{2}}"/>
>
> Many thanks,
>
> Robin
Rainer
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org