You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Jacob Singh (JIRA)" <ji...@apache.org> on 2009/05/19 11:35:45 UTC

[jira] Created: (SOLR-1173) Let contrib projects modify web.xml when running dist-war

Let contrib projects modify web.xml when running dist-war
---------------------------------------------------------

                 Key: SOLR-1173
                 URL: https://issues.apache.org/jira/browse/SOLR-1173
             Project: Solr
          Issue Type: New Feature
    Affects Versions: 1.4, 1.5
            Reporter: Jacob Singh
             Fix For: 1.4


Original problem:

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...

See: http://mail-archives.apache.org/mod_mbox/lucene-solr-user/200905.mbox/%3C4ED43C6D-320D-4E0D-835D-4366B0F08D0E@ehatchersolutions.com%3E



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Created: (SOLR-1173) Let contrib projects modify web.xml when running dist-war

Posted by Jacob Singh <ja...@gmail.com>.
Okay sure... This is a 10 min addition, the patch it only 15 lines or
something, but we can keep patching our copy if need be.

Best,
J

2009/5/19 Noble Paul നോബിള്‍  नोब्ळ् <no...@corp.aol.com>:
> we should refrain from adding new issues for 1.4 (unless it is a bug)
> if it is not very very important.
>
>
> On Tue, May 19, 2009 at 3:05 PM, Jacob Singh (JIRA) <ji...@apache.org> wrote:
>> Let contrib projects modify web.xml when running dist-war
>> ---------------------------------------------------------
>>
>>                 Key: SOLR-1173
>>                 URL: https://issues.apache.org/jira/browse/SOLR-1173
>>             Project: Solr
>>          Issue Type: New Feature
>>    Affects Versions: 1.4, 1.5
>>            Reporter: Jacob Singh
>>             Fix For: 1.4
>>
>>
>> Original problem:
>>
>> 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...
>>
>> See: http://mail-archives.apache.org/mod_mbox/lucene-solr-user/200905.mbox/%3C4ED43C6D-320D-4E0D-835D-4366B0F08D0E@ehatchersolutions.com%3E
>>
>>
>>
>> --
>> This message is automatically generated by JIRA.
>> -
>> You can reply to this email to add a comment to the issue online.
>>
>>
>
>
>
> --
> -----------------------------------------------------
> Noble Paul | Principal Engineer| AOL | http://aol.com
>



-- 

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

web: http://pajamadesign.com

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

Re: [jira] Created: (SOLR-1173) Let contrib projects modify web.xml when running dist-war

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@corp.aol.com>.
we should refrain from adding new issues for 1.4 (unless it is a bug)
if it is not very very important.


On Tue, May 19, 2009 at 3:05 PM, Jacob Singh (JIRA) <ji...@apache.org> wrote:
> Let contrib projects modify web.xml when running dist-war
> ---------------------------------------------------------
>
>                 Key: SOLR-1173
>                 URL: https://issues.apache.org/jira/browse/SOLR-1173
>             Project: Solr
>          Issue Type: New Feature
>    Affects Versions: 1.4, 1.5
>            Reporter: Jacob Singh
>             Fix For: 1.4
>
>
> Original problem:
>
> 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...
>
> See: http://mail-archives.apache.org/mod_mbox/lucene-solr-user/200905.mbox/%3C4ED43C6D-320D-4E0D-835D-4366B0F08D0E@ehatchersolutions.com%3E
>
>
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>



-- 
-----------------------------------------------------
Noble Paul | Principal Engineer| AOL | http://aol.com

[jira] Updated: (SOLR-1173) Let contrib projects modify web.xml when running dist-war

Posted by "Jacob Singh (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-1173?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacob Singh updated SOLR-1173:
------------------------------

    Attachment: xmltask_contrib_build.diff

Oops, forgot the common-build.xml diff

> Let contrib projects modify web.xml when running dist-war
> ---------------------------------------------------------
>
>                 Key: SOLR-1173
>                 URL: https://issues.apache.org/jira/browse/SOLR-1173
>             Project: Solr
>          Issue Type: New Feature
>    Affects Versions: 1.4, 1.5
>            Reporter: Jacob Singh
>             Fix For: 1.4
>
>         Attachments: xmltask_contrib_build.diff, xmltask_contrib_build.diff
>
>
> Original problem:
> 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...
> See: http://mail-archives.apache.org/mod_mbox/lucene-solr-user/200905.mbox/%3C4ED43C6D-320D-4E0D-835D-4366B0F08D0E@ehatchersolutions.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SOLR-1173) Let contrib projects modify web.xml when running dist-war

Posted by "Erik Hatcher (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-1173?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Erik Hatcher resolved SOLR-1173.
--------------------------------

    Resolution: Won't Fix

I agree with Hoss.  I'm marking as Won't Fix. 

However, I did as of r786752 commit a tweak to build.xml such that you can build Solr using "ant -Dweb.xml=/path/to/custom/web.xml" to incorporate a custom web.xml into solr.war.



> Let contrib projects modify web.xml when running dist-war
> ---------------------------------------------------------
>
>                 Key: SOLR-1173
>                 URL: https://issues.apache.org/jira/browse/SOLR-1173
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Jacob Singh
>             Fix For: 1.5
>
>         Attachments: xmltask_contrib_build.diff, xmltask_contrib_build.diff
>
>
> Original problem:
> 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...
> See: http://mail-archives.apache.org/mod_mbox/lucene-solr-user/200905.mbox/%3C4ED43C6D-320D-4E0D-835D-4366B0F08D0E@ehatchersolutions.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1173) Let contrib projects modify web.xml when running dist-war

Posted by "Hoss Man (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12722041#action_12722041 ] 

Hoss Man commented on SOLR-1173:
--------------------------------

FWIW: I'd prefer we not go down this route.

contribs (as a general rule) should be jars that can be built and dropped into a solr lib directly and used as is. If contribs start customizing the web.xml to include in Servlet Filters or Servlets then we either wind up with a single solr.war that *must* include that contrib (and it's dependencies) to function properly or multiple different war files that contain permutations of solr with various contribs baked into them.


Anything add on code that needs to modify the web.xml shouldn't be considered a simple plugin ... it should be considered "expert" level modifications.

If i understand the motivation for this, it's that an expert user (jacob) has private modifications (not intended for being committed into the ASF repository) and is requesting modifications to the solr build files to make this modifications possible when he builds his own version of solr -- not when using an official build.

This doesn't seem like something that needs to be in the solr build files -- if you're going to compile solr yourself anyway, then modifying the web.xml can be done just as easily in a build file at a "higher" level the solr as it can be at a "lower" level like a contrib.  ie: instead of...

{code}
svn co https://svn.apache.org/repos/asf/lucene/solr/trunk/ solr
cp my-private-contrib solr/contirb/my-private-contrib
cd solr
ant dist
{code}

...(where my-private-contrib/build.xml has the xmltask options you describe) you could just as easily do something like...

{code}
svn co https://svn.apache.org/repos/asf/lucene/solr/trunk/ solr
cp my-private-contrib solr/contirb/my-private-contrib
ant -f some-other-antfile-with-xmltask-commands.xml
cd solr
ant dist
{code}


In short: since what you want to do is already possible another way, I'd rather not make the change you are proposing because it could be inadvertently abused in future commits.




> Let contrib projects modify web.xml when running dist-war
> ---------------------------------------------------------
>
>                 Key: SOLR-1173
>                 URL: https://issues.apache.org/jira/browse/SOLR-1173
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Jacob Singh
>             Fix For: 1.5
>
>         Attachments: xmltask_contrib_build.diff, xmltask_contrib_build.diff
>
>
> Original problem:
> 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...
> See: http://mail-archives.apache.org/mod_mbox/lucene-solr-user/200905.mbox/%3C4ED43C6D-320D-4E0D-835D-4366B0F08D0E@ehatchersolutions.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-1173) Let contrib projects modify web.xml when running dist-war

Posted by "Shalin Shekhar Mangar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-1173?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shalin Shekhar Mangar updated SOLR-1173:
----------------------------------------

    Affects Version/s:     (was: 1.5)
                           (was: 1.4)
        Fix Version/s:     (was: 1.4)
                       1.5

Marking for 1.5

> Let contrib projects modify web.xml when running dist-war
> ---------------------------------------------------------
>
>                 Key: SOLR-1173
>                 URL: https://issues.apache.org/jira/browse/SOLR-1173
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Jacob Singh
>             Fix For: 1.5
>
>         Attachments: xmltask_contrib_build.diff, xmltask_contrib_build.diff
>
>
> Original problem:
> 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...
> See: http://mail-archives.apache.org/mod_mbox/lucene-solr-user/200905.mbox/%3C4ED43C6D-320D-4E0D-835D-4366B0F08D0E@ehatchersolutions.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-1173) Let contrib projects modify web.xml when running dist-war

Posted by "Jacob Singh (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-1173?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacob Singh updated SOLR-1173:
------------------------------

    Attachment: xmltask_contrib_build.diff

This patch provides a new task (dist-war-contrib).  This will do a contrib-crawl over the contrib/*/build.xml files looking for a dist-war task which will get run prior to running dist-war if you run dist.

If you want to modify the web.xml before it is added to the war:

1. Download the xmltask jar from: http://sourceforge.net/project/downloading.php?group_id=27398&filename=xmltask-v1.15.1.jar&a=8015257 and put it in lib

2. Add something like the following to your build.xml (in your contrib project): 

<target name="dist-war" depends="dist">
                <xmltask source="${solr-path}/build/web/WEB-INF/web.xml" dest="${solr-path}/build/web/WEB-INF/web.xml"
         preserveType="true"
             report="true">
                        <insert path="/web-app/filter[last()]" position="after">
<![CDATA[
  <filter>
    <display-name>HmacFilter</display-name>
    <filter-name>HmacFilter</filter-name>
    <filter-class>com.acquia.search.HmacFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>HmacFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
]]>
            </insert>
        </xmltask>
</target>


3. That's it! Deploy and your changes to web.xml will take effect, no fuss no muss.

Note: This does show some warnings for projects that do not implement dist-war


> Let contrib projects modify web.xml when running dist-war
> ---------------------------------------------------------
>
>                 Key: SOLR-1173
>                 URL: https://issues.apache.org/jira/browse/SOLR-1173
>             Project: Solr
>          Issue Type: New Feature
>    Affects Versions: 1.4, 1.5
>            Reporter: Jacob Singh
>             Fix For: 1.4
>
>         Attachments: xmltask_contrib_build.diff
>
>
> Original problem:
> 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...
> See: http://mail-archives.apache.org/mod_mbox/lucene-solr-user/200905.mbox/%3C4ED43C6D-320D-4E0D-835D-4366B0F08D0E@ehatchersolutions.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1173) Let contrib projects modify web.xml when running dist-war

Posted by "Erik Hatcher (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12722175#action_12722175 ] 

Erik Hatcher commented on SOLR-1173:
------------------------------------

Jacob - your use case makes sense for sure, though we don't have such a contrib in Solr's codebase currently and if we did we'd just hardcode wire it into solr.war just like we do the dataimport JSP pages currently.  It's not the cleanest most componentized way, to be sure.  

But at least now you simply can maintain your own plugin and your own web.xml and Solr's build allows you to incorporate it.

> Let contrib projects modify web.xml when running dist-war
> ---------------------------------------------------------
>
>                 Key: SOLR-1173
>                 URL: https://issues.apache.org/jira/browse/SOLR-1173
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Jacob Singh
>             Fix For: 1.5
>
>         Attachments: xmltask_contrib_build.diff, xmltask_contrib_build.diff
>
>
> Original problem:
> 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...
> See: http://mail-archives.apache.org/mod_mbox/lucene-solr-user/200905.mbox/%3C4ED43C6D-320D-4E0D-835D-4366B0F08D0E@ehatchersolutions.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1173) Let contrib projects modify web.xml when running dist-war

Posted by "Jacob Singh (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12722146#action_12722146 ] 

Jacob Singh commented on SOLR-1173:
-----------------------------------

"If i understand the motivation for this, it's that an expert user (jacob) has private modifications (not intended for being committed into the ASF repository) and is requesting modifications to the solr build files to make this modifications possible when he builds his own version of solr - not when using an official build."

Not exactly.  I don't have a modifications, I build a new contrib jar which needs to have its filter configured in web.xml.  It's not a modification to Solr code, and the war target, not the build target.  What I was proposing is that in the future, if any contrib modules needed web.xml extensions, they would have to break the build/war processes, and this 10 line patch prevents that without causing any other disruption; just like all the rest of the steps which use contrib-crawl.

Still, I guess I'm outnumbered, so we'll just have to keep maintaining our modification :)  But there's the rationale.

Best,
Jacob

> Let contrib projects modify web.xml when running dist-war
> ---------------------------------------------------------
>
>                 Key: SOLR-1173
>                 URL: https://issues.apache.org/jira/browse/SOLR-1173
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Jacob Singh
>             Fix For: 1.5
>
>         Attachments: xmltask_contrib_build.diff, xmltask_contrib_build.diff
>
>
> Original problem:
> 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...
> See: http://mail-archives.apache.org/mod_mbox/lucene-solr-user/200905.mbox/%3C4ED43C6D-320D-4E0D-835D-4366B0F08D0E@ehatchersolutions.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.