webtier@glassfish.java.net

Where to generate and store temporary files?

From: <forums_at_java.net>
Date: Fri, 20 May 2011 12:18:22 -0500 (CDT)

Hi

My managed bean will generate PDF based on the user inputs. These PDFs are
temporary, it is only valid for one specific request. I'm wondering where is
the correct directory I should generate these PDFs ...

Currently, I'm generating these PDFs to
C:\glassfish3\glassfish\domains\domain1\applications\myapp like this:

ExternalContext context =
FacesContext.getCurrentInstance().getExternalContext(); // path is
C:\glassfish3\glassfish\domains\domain1\applications\myapp String path =
context.getRealPath("/"); File temp = new File(path, "summary.pdf");
 

Is there a better place to store temporary files?

 


--
[Message sent by forum member 'hezjing']
View Post: http://forums.java.net/node/804682