We have several j2ee applications (e.g. A.ear, B.ear, C.war) running in a single jboss instance, we have a requirement to share a set of static files across these applications. So I should be in a position to access these files as http://myhost/folderA/fileA.htm or http://myhost/folderB/file.js from within my ear or war files.
How should I tell the jboss appserver (5.1.0) to look for these files, how should I deploy this static content in my
server/default/deploy directory or the
If you're using jboss with the Jetty server, you can re-use the
org.mortbay.jetty.servlet.DefaultServlet. I am sure tomcat has something similar or you can just add the jetty one (because it's a servlet, it will run on any servlet container).
Even though it's relatively easy to write it yourself, it's not because there are a bunch of things a quality implementation needs.
Take a look at the documentation of the
DefaultServlet on how to configure it, it has many features.
You should be able to place the static files in one location and have each of your contexts (A, B, C,...) have a servlet that serves these static files.
If you can configure it to look in the right folder, you may be able to reuse an existing servlet like
DefaultServlet. Or you may code your own servlet to serve static content: I once wrote one here.