Do NOT use getRealPath("/")!!!  If you read the API for this method it
says this functionality is optional and does not have to be supported,
particularly if the application is deployed as a WAR.  It just so
happens to work in Tomcat but in most real EE servers this method does
not return anything.

The best thing to do is either use the code you mentioned below to get
the temp directory or use System.getProperty("java.io.tmpdir")  An EE
server should be configured to allow writing to a temp directory.  In
Tomcat's case this system property gets set to tomcat_home/temp but real
app servers usually go to the operating system real temp directory.  The
advantage of using a real temp directory is that the operating system
will automatically purge old files for you.
 

-----Original Message-----
From: Giovanni Azua [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 09, 2007 10:21 AM
To: Struts Users Mailing List
Subject: OT: can't use JFreeChart plugin so ...

hi all,

Since I have a use-case where I can't use the JFreeChart plugin then 
ended up handling the writing and reading of the generated chart image 
files myself.

So my action implements ServletContextAware and using the function 
getRealPath("/") I can generate the png files with unique names (using 
an Id generator) and have them accessible to all my JSPs. Now this works

but I know it is not the cleanest solution i.e. it is filling up my web 
app with temporary data ... is there any other place accessible to my 
JSP files that I can use? would that be 
ServletContext.getAttribute("javax.servlet.context.tempdir")?

TIA,
regards,
Giovanni

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



---------------------------------------------------------------------------------------------------------
This e-mail message may contain privileged and/or confidential information, and 
is intended to be received only by persons entitled to receive such 
information. If you have received this e-mail in error, please notify the 
sender immediately. Please delete it and all attachments from any servers, hard 
drives or any other media. Other use of this e-mail by you is strictly 
prohibited.


All e-mails and attachments sent and received are subject to monitoring, 
reading and archival by Monsanto, including its subsidiaries. The recipient of 
this e-mail is solely responsible for checking for the presence of "Viruses" or 
other "Malware". Monsanto, along with its subsidiaries, accepts no liability 
for any damage caused by any such code transmitted by or accompanying this 
e-mail or any attachment.
---------------------------------------------------------------------------------------------------------


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

Reply via email to