Knute Johnson wrote:
> I don't know anything about log4j or spring but the Java Properties
> class loads it's data from an InputStream. An InputStream can be
> created easily from a File and several other sources. File syntax and
> methods are pretty straight forward. The description of abstract
> pathnames in the docs for File is where you need to look. Also write
> your self a program to list out the System Properties. There you will
> find many useful properties for creating abstract pathnames such as;
>
> file.separator
> path.separator
> user.dir
> user.home
> java.home
Some of which are completely irrelevant in a web application.
<http://java.sun.com/javase/6/docs/api/java/lang/ClassLoader.html#getResourceAsStream(java.lang.Str ing)>
gets a resource relative to the first classpath element that has it.
<http://java.sun.com/javase/6/docs/api/java/util/Properties.html#load(java.io.InputStream)>
and its variants do the same.
<http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletContext.html#getResourceAsStream(java.lang. String)>
in conjunction with
<http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String)>
gets a resource relative to the web-app context.
<http://java.sun.com/javase/6/docs/api/java/net/URL.html#URL(java.lang.String)>
and its get...() methods like
<
http://java.sun.com/javase/6/docs/ap...ava.lang.Class[])>
and related methods such as
<
http://java.sun.com/javase/6/docs/ap...ava.lang.Class[])>
get resources via their URLs.
--
Lew