cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject RE: LinkRewriterTransformer question
Date Thu, 02 Mar 2006 15:38:43 GMT
On Thu, 2006-03-02 at 15:58 +0100, Martijn C. Vos wrote:
> Bruno Dumon [mailto:bruno@outerthought.org] wrote:
> >  
> >  I would like to use the LinkRewriterTransformer to transform 
> >  links like
> >  this:
> >  
> >  myscheme:somevalue
> >  
> >  to something like
> >  
> >  http://someserver/some/path/somevalue
> >  
> >  Thus, the 'somevalue' should simply be prefixed with a static string.
> >  
> >  This seems like a pretty basic use case but I couldn't figure out how
> >  one of the standard input modules of Cocoon could do this. 
> >  Does anyone
> >  know if this is possible?
> 
> Sounds like a pretty standard use for the linkrewriter. The way I use it
> is this:
> 
> The input module (cocoon.xconf):
> 
>   <component-instance name="linkmap"
>                       class="org.apache.cocoon.components.modules.input.LocationMapModule"

>                       logger="core.modules.lm">
>     <file src="site://linkmap.xml"/>
>   </component-instance>
> 
> Linkrewriter (sitemap.xmap):
> 
>   <map:transformer logger="sitemap.transformer.linkrewriter" name="linkrewriter"
>         pool-grow="2" pool-max="32" pool-min="2"
>         src="org.apache.cocoon.transformation.LinkRewriterTransformer">
>     <schemes>linkmap</schemes>
>     <link-attrs>href action value src</link-attrs>
>   </map:transformer>
> 
> And a linkmap that contains stuff like:
> 
>   <match pattern="/content/foo/**.xml">
>     <location src="/bar/{1}.html"/>
>   </match>
> 
> Or something like that. I may be forgetting something, and I give no guarantees
> that this is correct, but this is what my code looks like, and it seems to work.
> 
> In the end, links like 
> 	linkmap:/content/foo/blah.xml
> should be rewritten as
> 	/bar/blah.html.
> 

Thanks a lot, that's exactly what I was looking for.

However, I think you got the classpath for the LocationMapModule wrong,
as it seems to be part of Forrest:
org.apache.cocoon.components.modules.input.LocationMapModule

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


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


Mime
View raw message