You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Thorsten Scherler <sc...@gmail.com> on 2012/09/11 14:50:03 UTC

c2.2.1 webapp blocklistener changes

Hi all,

I am ATM trying to upgrade a client project to use 2.2.1 but I am 
running into a problem where I see 2 solutions. I write it here so 
people that are doing an upgrade can benefit from our findings.

One big change in 2.2.1 is that the servlet connections are not forced 
to define any more in the spring config of the war since we are using 
the BlockDeploymentServletContextListener in the web.xml.

Now in the client project we have in 
src/main/webapp/WEB-INF/applicationContext.xml (which worked fine before)

<bean id="es.sadesi.boja" class="org.apache.cocoon.sitemap.SitemapServlet">
     <servlet:context mount-path="" context-path="/">
       <servlet:connections>
         <entry key="clientBlock" value-ref="es.clientBlock.service"/>
       </servlet:connections>
     </servlet:context>
   </bean>

This is due to the fact that the war project has its own sitemap and 
needs to listen to all other mounts. Now the above will fail complaining 
about missing protocol.

So I tried to use context-path="context:/" but then I get complains 
about the context:/ protocol is not defined. So for testing I pointed to 
the target dir of the deploy like 
context-path="file:///home/thorsten/src/clientBlock/target/clientBlock-3.0.7/".

With the last is working but it is not really a valid solution in case 
you deploy to e.g. tomcat, since the context needs to dynamically set.

A possible solution would be that I do a rewrite of the war block and 
move all sitemap stuff to a block on its own and set there the 
mount-path to /. However that solution is not my favourite since it 
means that I need to re-factor quite a lot of code.

So my question is I guess how can I configure the war servlet so its 
mounts on / and use the servlet- context?

Any ideas welcome.

-- 
Thorsten Scherler <scherler.at.gmail.com>
codeBusters S.L. - web based systems
<consulting, training and solutions>

http://www.codebusters.es/