[ 
http://issues.apache.org/jira/browse/COCOON-1898?page=comments#action_12432339 
] 
            
Simone Gianni commented on COCOON-1898:
---------------------------------------

Sorry to jump on this issue so late, but I also was in the need for a patching 
mechanism for web.xml and other files, and came up with another solution, 
mainly because i don't like XPatch that much (had to fight with it a lot in the 
past).

I aldready developed and I'm using internally the mvn plugin for it, it works 
using a src/main/xpatch folder, containing the patch files, so for example to 
patch the web xml you create a file 
src/main/xpatch/WEB-INF/web.xml-adding-filter.xml. 

My xml patching syntax is by far simpler than xpatch, for example to add a 
filter in the web.xml you just have to write a file like this :

<web-app xmlns:xp="http://xpatch/1.0";>
  <filter/> <!-- With this you are telling it to find the first <filter/> entry 
-->
  <filter xp:do="add"> <!-- With this you are telling it to add this node and 
its children -->
    <filter-name>MyFilter</filter-name>
    <display-name>My filter</display-name>
    <filter-class>....</filter-class>
    <init-param>
      <param-name>param</param-name>
      <param-value>value</param-value>
    </init-param>
  </filter>
  <filter-mapping/>
  <filter-mapping xp:do="add">
      <filter-name>MyFilter</filter-name>
      <servlet-name>Cocoon</servlet-name>
  </filter-mapping>  
</web-app>

For many other tasks it's even simpler, for example to add a new match on the 
root sitemap, this is enought :

<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0";>
  <map:pipelines>
    <map:pipeline>
          <map:match pattern="_mystuff/**">
            <map:mount src="mystuff/" uri-prefix="_mystuff"/>
          </map:match>
    </map:pipeline>
  </map:pipelines>
</map:sitemap>

and the new match will be added as the last element of the first encountered 
pipeline.

I'm planning to contribute this anyway, so let me know if it could be a good 
alternative.

> [PATCH] XPatch support for maven-cocoon-deployer-plugin
> -------------------------------------------------------
>
>                 Key: COCOON-1898
>                 URL: http://issues.apache.org/jira/browse/COCOON-1898
>             Project: Cocoon
>          Issue Type: Improvement
>          Components: - Build System: Maven
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Lars Trieloff
>         Attachments: maven-cocoon-deployer-plugin-with-xpatch-support.patch
>
>
> The cocoon-deployer-plugin has currently no support for XPatch, which makes 
> it difficult to modify the web.xml when developing cocoon blocks. For example 
> the cocoon-xmldb-impl block should add, when deployed, a servlet for xindice 
> and a servlet mapping for the xindice servlet. This was possible in 2.1 using 
> the XConfToolTask, but is no longer possible with the current state of the 
> deployer-plugin.
> My patch adds support for patching the web.xml file using *.xweb files in the 
> /conf directory of a block by filtering the block's jar file during 
> deployment for conf/*.xweb files, caching the patch document temporarily and 
> applying them (using code from the orgiginal XConfToolTask in 2.1) to the 
> web.xml. The patch has currently no support for other files than conf/*.xweb 
> files and does not support any property expansion.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to