> From: Lyallex [mailto:lyal...@gmail.com] > Subject: Dynamic Resources: getRealPath() returns the 'wrong' path > > INFO: The path to the image cache is > C:\servers\tomcat\apache-tomcat-6.0.16\temp\1-ROOT\imagecache
ServletContext.getRealPath() is one of the leftovers from the early days that probably should have been deprecated. The container is under no obligation to provide access to the underlying file system (if there is one), other than to a spec-defined temporary work area. To access resources contained within the webapp's name space, you likely should be using getResourceAsStream(), either the ClassLoader or the ServletContext version, as appropriate. Writing to the webapp's deployment location is a bad idea - you again have no guarantee that it's allowed, and you're at the whims of the container and execution environment controlling the actual location. Much better to write your files outside of Tomcat's directory space, using a path defined by system property, environment variable, or webapp property. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org