You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Denis Ponomarev <oz...@romsat.ua> on 2004/03/01 15:15:39 UTC

Re[2]: Reading a file in a "BaseEngine" subclass

EM> On the same note - When using the global object (a simple POJO) how can
EM> I get the path to the classpath / context ? According to my tests, when
EM> opening a file , the root path ("/") is really the root path of the
EM> machine. I also tried
EM> ClassLoader.getSystemResourceAsStream("com/sphera/rd..../file.xml")
EM> which didn't do the trick..

EM> Any ideas ?

Try this:

InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
if (stream == null) {
        stream = getClass().getResourceAsStream(file);
}




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org