I like Grant's suggestion as the simplest solution.

As for XML merging and XSLT, I really wouldn't want to go that route personally, but one solution that comes close to that is to template web.xml with some substitution tags and use Ant's ability to replace tokens. So we could put in @FILTER@ and @FILTER_MAPPING@ placeholders in web.xml and pull in the replacements from fragment files. But even with all of these fancy options available, I'd still just use the alternate web.xml technique that Grant proposed.

        Erik


On May 13, 2009, at 10:55 PM, Jacob Singh wrote:

HI Grant,

That's not a bad idea... I could try that. I was also looking at cactus:
http://jakarta.apache.org/cactus/integration/ant/index.html

It has an ant task to merge XML. Could this be a contrib-crawl add- on?

Alternately, do you know of any xslt templates built for this?  Could
write one, but that's a fair bit of work to support everything.
Perhaps an xslt task combined with a contrib-crawl would do the trick?

Best,
-J

On Wed, May 13, 2009 at 6:07 PM, Grant Ingersoll <gsing...@apache.org> wrote:
Hmmm, maybe we need to think about someway to hook this into the build process or make it easier to just drop it into the conf or lib dirs. I'm no web.xml expert, but I'm sure you're not the first one to want to do this
kind of thing.

The easiest way _might_ be to patch build.xml to take a property for the location of the web.xml, defaulting to the current Solr one. Then, people who want to use their own version could just pass in - Dweb.xml=<path to my web.xml>. The downside to this is that it may cause problems for us devs when users ask questions about strange behavior and it turns out they have
mucked up the web.xml

FYI: dist-war is in build.xml, not common-build.xml.

-Grant

On May 12, 2009, at 5:52 AM, Jacob Singh wrote:

Hi folks,

I just wrote a Servlet Filter to handle authentication for our
service.  Here's what I did:

1. Created a dir in contrib
2. Put my project in there, I took the dataimporthandler build.xml as
an example and modified it to suit my needs.  Worked great!
3. ant dist now builds my jar and includes it

I now need to modify web.xml to add my filter-mapping, init params,
etc. How can I do this cleanly? Or do I need to manually open up the
archive and edit it and then re-war it?

In common-build I don't see a target for dist-war, so don't see how it
is possible...

Thanks!
Jacob

--

+1 510 277-0891 (o)
+91 9999 33 7458 (m)

web: http://pajamadesign.com

Skype: pajamadesign
Yahoo: jacobsingh
AIM: jacobsingh
gTalk: jacobsi...@gmail.com

--------------------------
Grant Ingersoll
http://www.lucidimagination.com/

Search the Lucene ecosystem (Lucene/Solr/Nutch/Mahout/Tika/Droids) using
Solr/Lucene:
http://www.lucidimagination.com/search





--

+1 510 277-0891 (o)
+91 9999 33 7458 (m)

web: http://pajamadesign.com

Skype: pajamadesign
Yahoo: jacobsingh
AIM: jacobsingh
gTalk: jacobsi...@gmail.com

Reply via email to