cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francesco Chicchiriccò <ilgro...@apache.org>
Subject Re: [ cocoon3 ] map parameters
Date Mon, 07 Nov 2011 12:03:53 GMT
Il 07/11/2011 12:48, Andre Juffer ha scritto:
> On 11/07/2011 01:43 PM, Francesco Chicchiriccò wrote:
>> On 07/11/2011 12:35, Andre Juffer wrote:
>>
>> What happens if you use one of standard generators - like the XML
>> generator in the first example? I mean:
>>
>> <map:match pattern="create/image/creator/*">
>> <map:generate src="sax-pipeline/{map:1}.xml" />
>>
>> You should now get an exception for something missing: is it
>> "sax-pipeline/3276800.xml" or "sax-pipeline/null.xml"?
>>
>
> This is exactly the error I get. I tried:
>
> <map:generate src="{map:1}.xml" />
>
> The exception I get
>
> Caused by: java.io.FileNotFoundException: 
> /home/juffer/TriBC/projects/cocoon3-webapp/tribc-img/src/main/resources/COB-INF/3276800.xml

> (No such file or directory)

Ok, this means that {map:1} is handled correctly by the sitemap, since 
it is passed to XML generator.

See attached a patch for cocoon-sample that modifies the current sample 
for StringTemplateGenerator by passing an additional parameter from URL 
match: once applied the patch and launched "mvn jetty:run" under 
cocoon-sample, you will be able to access URLs like as

http://localhost:8888/string-template/generator/anUrlParameter

getting an XML document that shows, among usual things, "anUrlParameter" 
or whatever value you pass after generator/.

I am giving this example because StringTemplateGenerator is the first 
generator coming into my mind that supports parameter passing.

I suspect there should be something wrong with your generator, then; 
take a look at StringTemplateGenerator's sources [1] for reference.

Cheers.

[1] 
http://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateGenerator.java

-- 
Francesco Chicchiriccò

Apache Cocoon Committer and PMC Member
http://people.apache.org/~ilgrosso/


Mime
View raw message