3 Replies Latest reply on May 17, 2007 10:29 AM by brian.stansberry

    global servlet needed

    price34

      hi,

      we have a need to have a "global" servlet. we'd like to create a servlet and deploy a .jar file into say the jboss lib folder and have that servlet be accessable from any deployed war. the purpose of the servlet is to verify an application's health (lookup an applications jndi values and so forth). we'd like to be able to deploy this without having to deploy all of our applications into production. is there a way to inject this into all our web applications without touching the web.xml to define the servlet?

      thanks!

        • 1. Re: global servlet needed
          brian.stansberry

          In the jbossweb-tomcat55.sar/conf folder there is a web.xml file whose contents are basically integrated into the web.xml of every deployed web app. The servlets you see there are what allow things like serving static content and jsps to work. You could add your servlet to this file. Add your jar to server/xxx/lib or to the jbossweb-tomcat55.sar.

          • 2. Re: global servlet needed
            price34

            thank you very much!

            this is very cool and opens alot of possibilities.

            However, the servlet does not appear to be executing in the context of the war that it is being invoked through. Is there a way to have it defined globally but at the same time have it execute within the context of the web app that it is being invoked through?

            • 3. Re: global servlet needed
              brian.stansberry

              Not sure what you mean by not "executing in the context of the war that it is being invoked through". Can you give an example?

              (Advance warning: you've already hit the limit of my detail knowledge of how this works; hopefully others know more. I *vaguely* recall reading the code that gets executed as the war deploys and seeing that the conf/web.xml stuff gets added in as if were a regular web.xml; i.e. servlets independently added to the individual webapp as opposed to some central service or something.)