You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Anna Afonchenko <an...@ubaccess.com> on 2002/12/30 13:40:30 UTC

RequestParameterAction question

Hi all.
I am using RequestParameterAction to process parameters given in http request.
My http request looks something like this:
http://localhost:8080/cocoon/test?e-mail=user@domain.com

here is my pipeline:

<map:match pattern="test">
    <map:act type="request">
        <map:parameter name="parameters" value="true"/>
        <map:generate src="testing/testPage.xml"/>
        <map:transform src="testing/stylesheet.xsl">
            <map:parameter name="e-mail" value="{e-mail}"/>
        </map:transform>
        <map:serialize type="xml"/>
    </map:act>
</map:match>

This way I pass the e-mail parameter to the stylesheet.
Now here is my question:
Can I preprocess the request parameter before passing it further?
E.g. in this case can I pass to the xsl instead of the whole e-mail parameter
something like: {substring-before('@',e-mail)} to pass only the username to xsl?

I know that in this case I don't really need it, because I can do this inside the xsl, but
I just give this as an example.
What I will realy need is for example to call another pipeline through the cocoon:// protocol
with part of the given request parameter that I want to extract.
Is it possible to do? Can somebody explain this to me?

Thank you very much for help.

Anna

Re: RequestParameterAction question

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 30.Dec.2002 -- 02:40 PM, Anna Afonchenko wrote:
> Hi all.
> I am using RequestParameterAction to process parameters given in http request.
> My http request looks something like this:
> http://localhost:8080/cocoon/test?e-mail=user@domain.com
> 
> here is my pipeline:
> 
> <map:match pattern="test">
>     <map:act type="request">
>         <map:parameter name="parameters" value="true"/>
>         <map:generate src="testing/testPage.xml"/>
>         <map:transform src="testing/stylesheet.xsl">
>             <map:parameter name="e-mail" value="{e-mail}"/>
>         </map:transform>
>         <map:serialize type="xml"/>
>     </map:act>
> </map:match>
> 
> This way I pass the e-mail parameter to the stylesheet.
> Now here is my question:
> Can I preprocess the request parameter before passing it further?
> E.g. in this case can I pass to the xsl instead of the whole e-mail parameter
> something like: {substring-before('@',e-mail)} to pass only the username to xsl?

Please look at the InputModules stuff. You can write your own module
that applies this function or -- in case of the jxpath-based modules
-- use arbitrary java methods on the values. Please look at the JXPath
documentation at jakarta.apache.org for specifics of JXPath.

> I know that in this case I don't really need it, because I can do this inside the xsl, but
> I just give this as an example.
> What I will realy need is for example to call another pipeline through the cocoon:// protocol
> with part of the given request parameter that I want to extract.
> Is it possible to do? Can somebody explain this to me?

It is possible and since you can add parameters using the HTTP GET
syntax i.e "cocoon://pipeline?one={e-mail}&amp;two={foo}"

	Chris.

Please follow up summarizing your problem and which suggested solution
/ information worked for you when you consider your problem
solved. Add "SUMMARY: " to the subject line. This will make FAQ
generation and searching the list easier. In addition, it makes
helping you more fun. Thank you.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>