Created
March 14, 2012 21:16
-
-
Save nicholashagen/2039581 to your computer and use it in GitHub Desktop.
Accessing Temporary Directory in Servlet Container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File tmpDir = (File) servletContext.getAttribute(SERVLET_TMP_DIR); | |
if (tmpDir == null) { | |
throw new ServletException("Servlet container does not provide temporary directory"); | |
} | |
File workDir = new File(tmpDir, "classes"); | |
if (!workDir.mkdirs()) { | |
throw new ServletException("Unable to create classes temporary directory"); | |
} | |
File test = new File(workDir, test); | |
// write to file test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment