cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominic Tootell" <dominic.toot...@bbc.co.uk>
Subject RE: Cocoon22: Can 2 blocks map to the same mount path?
Date Tue, 17 Jun 2008 07:50:45 GMT
Thank you for that Reinhard,
That super class stuff answers another question I had :-)
  

What I have rather than inheritance is two actually two implementations.  For example:

http://localhost:8888/recommendations?url=blah
http://localhost:8888/recommendations?rdf=blah


Under the hood these are actually two implementations of recommendations engines that provide
the same business functionality, but are implemented in complete different ways (totally different
code).  Therefore, the code is separate, and seems sensible to be in two separate blocks.
 But from a user perspective, they don't want to know about the differences in implementation;
that just call /recommendations.  Hence mapping the two blocks at one mount-path.


I'll have a play around.

Cheers,
/dom







-----Original Message-----
From: Reinhard Pötz [mailto:reinhard@apache.org] 
Sent: 17 June 2008 07:28
To: users@cocoon.apache.org
Subject: Re: Cocoon22: Can 2 blocks map to the same mount path?

Dominic Tootell wrote:
> Hi there,
> 
> Is it possible to have 2 cocoon blocks that map to the same mount-path 
> in src/main/resources/META-INF/cocoon/spring/block-servlet-service.xml? i.e.
> 
> Block 1:
> 
> 
>   <bean name="com.bbc.cmc.cmc-block1.service" 
> class="org.apache.cocoon.sitemap.SitemapServlet">
>     <servlet:context mount-path="/" 
> context-path="blockcontext:/cmc-block1/"/>
>   </bean>
> 
> Block 2:
> 
> 
>   <bean name="com.bbc.cmc.cmc-block2.service" 
> class="org.apache.cocoon.sitemap.SitemapServlet">
>     <servlet:context mount-path="/" 
> context-path="blockcontext:/cmc-block2/"/>
>   </bean>
> 
> I've tried to get it working but so far with no success.  Is there a 
> property I can set on the beans to allow this? Or is it just not 
> architecture possible in 2.2?

You can't mount two servlet-services at the same mount path. I guess that you want to make
one servlet-service extend another servlet-service. This can be done by declaring a "super"
connection:

<bean name="com.bbc.cmc.cmc-block1.service">
   <servlet:context
     mount-path="/cmc-block1"
     context-path="blockcontext:/cmc-block1/">
   </servlet:context>
</bean>

<bean name="com.bbc.cmc.cmc-block2.service">
   <servlet:context
     mount-path="/"
     context-path="blockcontext:/cmc-block2/">

     <servlet:connections>
       <entry key="super" value-ref="com.bbc.cmc.cmc-block1.service"/>
     </servlet:connections>

   </servlet:context>
</bean>

If com.bbc.cmc.cmc-block2.service can't provide a resource, its parent
(com.bbc.cmc.cmc-block1.service) is asked for it.

HTH

-- 
Reinhard Pötz                           Managing Director, {Indoqa} GmbH
                          http://www.indoqa.com/en/people/reinhard.poetz/

Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member                  reinhard@apache.org
________________________________________________________________________

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


http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are
not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify
the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
					

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


Mime
View raw message