You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Richard Lewis <ri...@fastmail.co.uk> on 2004/11/25 18:14:51 UTC

raw-request-param

Hello Cocooners,

I am implementing a search engine for my Cocoon site as a Java servlet.
All Cocoon has to do is send the search terms from an HTML form to the
servlet and then send the results through a stylesheet:

<map:match type="request-parameter" pattern="search">
    <map:generate
    src="http://localhost/search?terms={raw-request-param:search}" />
    ......
</map:match>

It works, except when the request parameter 'search' has a space in it,
it is passed on as "term1 term2" where it should be "term1+term2". This
causes the sitemap to break because there is a space in the map:generate
src URI above.

Does anyone know whats wrong with this?

Cheers,
Richard

-- 
  Richard Lewis
  richardlewis@fastmail.co.uk


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Passing a value from a transformer to the sitemap

Posted by Upayavira <uv...@odoko.co.uk>.
Eran Fuchs wrote:
> Hi all.
> I'm trying to send information from a transformer (or any other sitemap
> components) back to the sitemap.
> I need to extract and process a value from the piped xml, and control the
> flow according to it.
> I have tried using the request-attr output module, but the change seems to
> be only noticeable inside components (following components as well) , and
> does not seem to propagate to the sitemap itself (the sitemap still uses the
> old value, when used as {request-attr:my-value}).
> Any ideas?

This is not possible, by design. Cocoon pipelines are two stages, 
construction and execution. During construction of a pipeline you can 
alter the components that are used, but during execution you cannot. 
Thus, you cannot alter the structure of the pipeline based upon the data 
passing through it. If you need to do that, you probably want to be 
using flowscript in some way as your controller, and then choose your 
pipeline based upon your decision.

Regards, Upayavira

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Passing a value from a transformer to the sitemap

Posted by Eran Fuchs <er...@mdrm.com>.
Hi all.
I'm trying to send information from a transformer (or any other sitemap
components) back to the sitemap.
I need to extract and process a value from the piped xml, and control the
flow according to it.
I have tried using the request-attr output module, but the change seems to
be only noticeable inside components (following components as well) , and
does not seem to propagate to the sitemap itself (the sitemap still uses the
old value, when used as {request-attr:my-value}).
Any ideas?

Thanks,
  Eran


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.322 / Virus Database: 267.3.0 - Release Date: 30/05/2005


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: raw-request-param

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Richard Lewis wrote:
> Hello Cocooners,
> 
> I am implementing a search engine for my Cocoon site as a Java servlet.
> All Cocoon has to do is send the search terms from an HTML form to the
> servlet and then send the results through a stylesheet:
> 
> <map:match type="request-parameter" pattern="search">
>     <map:generate
>     src="http://localhost/search?terms={raw-request-param:search}" />
>     ......
> </map:match>
> 
> It works, except when the request parameter 'search' has a space in it,
> it is passed on as "term1 term2" where it should be "term1+term2". This
> causes the sitemap to break because there is a space in the map:generate
> src URI above.
> 
> Does anyone know whats wrong with this?
raw request parameter module does not work and will not work due to the 
servlet specs. You should nest two input modules to make it work: 
request parameter module and url encode module.

Example:

<map:match pattern="remote-action">
	<map:generate 
src="{global:skid-url}?LIC_ID={url-encode:{session-attr:userid}}&amp;KH_KOD={url-encode:{request-param:contractor-code}}"/>
	<map:serialize/>
</map:match>


-- 
Leszek Gawron                                      lgawron@mobilebox.pl
Project Manager                                    MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org