Why don't you have access to the ServletContext?  That's really the only
portable way to access resources in your webapp.

-- 
Tim Moore / Blackboard Inc. / Software Engineer
1899 L Street, NW / 5th Floor / Washington, DC 20036
Phone 202-463-4860 ext. 258 / Fax 202-463-4863


> -----Original Message-----
> From: Etienne [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, February 07, 2003 5:01 PM
> To: 'Tomcat Users List'
> Subject: How to get the web application or Tomcat path inside a class
> 
> 
> Hi, 
> 
> Is there a way to get the web application path or the tomcat 
> path inside a java bean not using any "Request" object? I am 
> running tomcat on Windows. I need sometime to access xml file 
> placed on the <web_app_path>/xml/ folder. On windows, it is 
> easy to retrace them because the starting (default) path for 
> retrieving a file is based on the web application path. So 
> new File("xml/myfile.xml") works. 
> 
> But on the unix box, the starting (default) path is at 
> <tomcat_path>/bin/. I don't want to put my xml files there. 
> So, is there a way (without the 
> servletContext.getRealPath("//");  method, because I don't 
> have access to the servletContext object ) to retrieve the 
> path of the tomcat path or better,  the Web Application path?
> 
> tks
> 
> E.L. 

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

Reply via email to