cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thorsten.scherler....@juntadeandalucia.es>
Subject Re: [cocoon3] Passing parameters with Invocation
Date Tue, 16 Jun 2009 09:25:07 GMT
On Mon, 2009-06-15 at 11:16 +0200, Steven Dolg wrote:
> Hi,
> 
> Passing parameters into the sitemap will work when you do it this way:
> 
> sitemap:
> 
> <map:match pattern="*">
>   <map:generate src="xml/{map:1}.xml"/>
>   <map:transform src="xsl/{map:1}.xsl">
>     <map:parameter name="firmaElectronica" value="{jexl:firmaElectronica}"/>
>     <map:parameter name="hash" value="{jexl:cocoon.request.hash}"/>
>   </map:transform>
>   <map:serialize/>
> </map:match>
> 
> 
> invocation:
> 
> ObjectModel objectModel = new ObjectModel(new HashMap<String, Object>());
> objectModel.put("firmaElectronica", "My Parameter Value");
> invocation.setObjectModel(objectModel);

Yeah doing it this way works well. 

> 
> 
> The stuff under "cocoon.request" is only available when there is a real 
> HttpServletRequest and it is put inside the parameters 
> (o.a.c.s.u.HttpContextHelper).
> 
> 
> I hope that's what you need... ;-)

Yeah thank you very much. BTW my current problem to use c3 is that my
client needs a stable release. Are there plans to do a release soon?

salu2

> Cheers,
> Steven
> 
> Thorsten Scherler schrieb:
> > Hi all,
> >
> > I am playing around with cocoon3 for a new custom project. I decided to
> > give c3 a go because I need the possibility to invoke different pipes
> > and use their outcome to calculate the response in good old java.
> >
> > I found some junit tests (SitemapBuilderTest.java in cocoon-sample)
> > where I found the Invocation object. Using it in my code works fine as
> > long I do not pass variables to the pipe.
> >
> > I am having following sitemap:
> >
> > <map:match pattern="*">
> >   <map:generate src="xml/{map:1}.xml"/>
> >   <map:transform src="xsl/{map:1}.xsl">
> >     <map:parameter name="firmaElectronica"
> >       value="{jexl:cocoon.request.firmaElectronica}"/>
> >     <map:parameter name="hash" value="{jexl:cocoon.request.hash}"/>
> >   </map:transform>
> >   <map:serialize/>
> > </map:match>
> >
> > When I request http://localhost:8888/validar?firmaElectronica=xxxxx
> > the <map:parameter name="firmaElectronica"/> correctly uses the value of
> > the parameter.
> >
> > In my java code I am doing 
> > ...
> > Invocation invocation = this.buildInvocation("validar",stream);
> > Map<String, Object> parameters = new HashMap<String, Object>();
> > parameters.put("firmaElectronica", eSignature);
> > invocation.setParameters(parameters);
> > invoke(invocation);
> >
> > But the parameters are not get picked up. I as well tried
> > invocation.setObjectModel(model);
> >
> > and changing in the sitemap 
> > <map:parameter name="firmaElectronica"
> > value="{firmaElectronica}"/>
> >
> > but that did not worked either.
> >
> > How can I pass parameter to the invocation that will the get picked up
> > in the sitemap.
> >
> > Any hints welcome.
> >
> > salu2
> >   
> 
-- 
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>

Sociedad Andaluza para el Desarrollo de la Sociedad 
de la InformaciĆ³n, S.A.U. (SADESI)





Mime
View raw message