cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jasha Joachimsthal" <j.joachimst...@hippo.nl>
Subject RE: LinkRewriterTransformer question
Date Thu, 02 Mar 2006 15:52:15 GMT


> -----Original Message-----
> From: Bruno Dumon [mailto:bruno@outerthought.org]
> Sent: donderdag 2 maart 2006 16:39
> To: users@cocoon.apache.org
> Subject: RE: LinkRewriterTransformer question
> 
> 
> 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
> 

Indeed. Martijn used the Hippo version of Cocoon :)
If you have the regular Cocoon from Apache, you have something like this in your cocoon.xconf

    <component-instance name="locationmap"
      class="org.apache.forrest.locationmap.LocationMapModule" 
      logger="sitemap.modules.locationmap">
      <file src="cocoon://my-site/locationmap.xml"/>
    </component-instance>> 



Jasha Joachimsthal

---------

Hippo
Oosteinde 11
1017 WT Amsterdam
The Netherlands
+31 (0)20 5224466 

jasha@hippo.nl
www.hippo.nl

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


Mime
View raw message