Thanks again for your help. JNDI solution is tempting. The only problem
is that I have many instances of tomcat and I prefer not to hardcode the
path into server.xml. That's why I'm still looking for a more flexible
(even if less elegant and less portable ) solution.

> This is because if you deploy the app as a .war then you wont 
> be able to do
> getResourceAsStream(fileName) withing that context.

Not true - it works even if you deploy from a war (at least in tomcat
5.0) . It simply looks for the file in the directory where tomcat
unzipped the war.

Michal.
 
> Need more help ?
> Email me 
> 
> 
> Regards
> Guru 
> 
> 
> -----Original Message-----
> From: Michal Kwiatek [mailto:[EMAIL PROTECTED]
> Sent: 12 April 2005 10:35
> To: Tomcat Users List
> Subject: RE: Check deployment dir programatically
> 
> 
> This is a solution. I'll do it if there's not a better one. Any other
> ideas?
> 
> Michal. 
> 
> > -----Original Message-----
> > From: Raghupathy,Gurumoorthy 
> > [mailto:[EMAIL PROTECTED] 
> > Sent: Tuesday, April 12, 2005 11:27 AM
> > To: 'Tomcat Users List'
> > Subject: RE: Check deployment dir programatically
> > 
> > Why  dont you setup a JNDI variable for your context which 
> > will set the value of base directory ... And then use it in 
> > your app... 
> > http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources
> > -howto.html
> > 
> > We use JNDI ... :o) 
> > 
> > 
> > -----Original Message-----
> > From: Michal Kwiatek [mailto:[EMAIL PROTECTED]
> > Sent: 12 April 2005 10:16
> > To: Tomcat Users List
> > Subject: Check deployment dir programatically
> > 
> > 
> > Hello all,
> > 
> > How can I programatically check the absolute path to the deployment
> > direcotory (webapps/myApp directory) on the server?
> > 
> > 
> request.getSession().getServletContext().getResourceAsStream(fileName)
> > works fine to read a file from the direcory, but I see no 
> > equivalent to
> > check the root deployment directory.
> > 
> > Thanks in advance,
> > Michal.
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

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

Reply via email to