tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Kriger <andy.kri...@gmail.com>
Subject contextDestroyed and getRealPath question
Date Thu, 03 Nov 2005 18:07:19 GMT
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


Mime
View raw message