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);


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... ;-)

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

Reply via email to