FAQ http://jakarta.apache.org/tomcat/faq/misc.html#getResourceAsStream

-Tim

Giuseppe Briotti wrote:

Hi all!

I need to retrieve a file from inside a servlet. If I try:

Url myURL = servletcontext.getResource("/WEB-INF/myFile.xml");
File myFile = myURL.getFile();

If I try this, I obtain a different behaviour depending on the web container:

on Tomcat 4 myURL contains \localhost\myapp\WEB-INF\myFile.xml i.e.
path relative to the host running application

on Jetty myURL contains c:\mywebserver\myapp... i.e. absolute path

Thus, I think that there is a better method to retrieve the file,
isn't it?


Any ideas or suggestions?


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to