Hola, No, don't use getServletContextName(). Besides being optional, it doesn't necessarily related to a path on the disk. For that matter, don't use the disk path approach anyhow, as things get quirky / fragile for users running packed WARs. There are a couple of alternatives, one using the classpath and one using the ServletContext#getResource approach.
The classpath one is the standard Java classpath resource lookup mechanism: in your class, do getClass().getResource("path.to.your.resource") -- in a webpp, this will automatically use the webapp's specific classloader by default, so if you have a config file in WEB-INF/lib or WEB-INF/classes, it will get picked up. (And conveniently, one could specify server-wide Solr defaults in a higher classloader like the common server one). The ServletContext one is very similar: use ServletContext.getResource with the same path semantics, and a resource anywhere under your webapp root will be fetched. To compare / contrast the two: the ServletContext approach depends on a servlet container, i.e. is hard to use and test from a command-line utility. It also doesn't provide the hierarchical defaulting mechanism as easily as the classpath one. On the flip side, some people only like to have classes on the classpath in the name of "neatness" although in reality, there are a lot of things (for example DTD, XSD spec files) on the classpath at runtime. If you need a more concrete example of how to do this, I'll be glad to provide one. Yoav On 4/18/06, Yonik Seeley <[EMAIL PROTECTED]> wrote: > On 4/18/06, Chris Hostetter <[EMAIL PROTECTED]> wrote: > > (or does ServletContext.getServletContextName() not do what I think i > > remember it doing) > > Unfortunately not.... the javadoc says it comes from the web.xml > > java.lang.String getServletContextName() > Returns the name of this web application corresponding to > this ServletContext as specified in the deployment descriptor for this > web application by the display-name element. > > -Yonik > -- Yoav Shapira Nimalex LLC 1 Mifflin Place, Suite 310 Cambridge, MA, USA [EMAIL PROTECTED] / www.yoavshapira.com