You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andy Kriger <an...@gmail.com> on 2005/11/03 19:07:19 UTC

contextDestroyed and getRealPath question

I am trying to do something in contextDestroyed that requires the
filesystem directory of the web application. However, once
contextDestroyed has been called that path no longer exists.

public void contextDestroyed(ServletContextEvent event)
{
	String path = event.getServletContext().getRealPath("/");
	System.out.println(path);
	File file = new File(path);
	System.out.println("exists? " + (file.exists())); // returns false
	System.out.println("directory? " + (file.isDirectory())); // returns false
	System.out.println("readable? " + (file.canRead())); // returns false
}

Is there a way to access the webapp when the application is
reloaded/stopped/undeployed but before Tomcat cleans up the temporary
directory that contains app?

thx
andy

For more info on what I'm trying to see
http://forum.hibernate.org/viewtopic.php?t=935948&postdays=0&postorder=asc&highlight=webapp+reload&start=150&sid=d772baa08d3390eb5232ed4164d81125
(it's the post w the code in it and I'm just trying to test it out in
my own app and see if it fixes anything)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org