Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Jetty/Reference/Temporary Directories"

m
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{Jetty Reference
 
{{Jetty Reference
 
|introduction =  
 
|introduction =  
 +
 +
{{Jetty Redirect|http://www.eclipse.org/jetty/documentation/current/temporary-directories.html}}
  
 
Jetty itself has no temporary directories, but you can assign a directory for each web application, into which the WAR is unpacked, JSPs compiled on-the-fly, etc.
 
Jetty itself has no temporary directories, but you can assign a directory for each web application, into which the WAR is unpacked, JSPs compiled on-the-fly, etc.
Line 8: Line 10:
  
 
# Try to use an explicit directory specifically for this webapp:
 
# Try to use an explicit directory specifically for this webapp:
#* Iff webapp.getTempDirectory() is set, use it. Do NOT delete it on jvm exit.
+
#* Iff [http://download.eclipse.org/jetty/stable-8/apidocs/org/eclipse/jetty/webapp/WebAppContext.html#setTempDirectory(java.io.File) webapp.getTempDirectory()] is set, use it. Do NOT delete it on jvm exit.
 
#* Iff javax.servlet.context.tempdir context attribute is set for this webapp && exists && writeable, then use it. Do NOT delete on jvm exit.
 
#* Iff javax.servlet.context.tempdir context attribute is set for this webapp && exists && writeable, then use it. Do NOT delete on jvm exit.
 
# Create a directory based on global settings. The new directory will be called "Jetty_"<ins>host</ins>"''"<ins>port</ins>"''''"<ins>context</ins>"''"+virtualhost :
 
# Create a directory based on global settings. The new directory will be called "Jetty_"<ins>host</ins>"''"<ins>port</ins>"''''"<ins>context</ins>"''"+virtualhost :

Latest revision as of 16:00, 29 April 2013



Introduction

Warning2.png
Jetty 7 and Jetty 8 are now EOL (End of Life)




THIS IS NOT THE DOCUMENTATION YOU ARE LOOKING FOR!!!!!






All development and stable releases are being performed with Jetty 9 and Jetty 10.






This wiki is now officially out of date and all content has been moved to the Jetty Documentation Hub






Direct Link to updated documentation: http://www.eclipse.org/jetty/documentation/current/temporary-directories.html


Jetty itself has no temporary directories, but you can assign a directory for each web application, into which the WAR is unpacked, JSPs compiled on-the-fly, etc.

The algorithm for determining a webapp's temporary directory location is as follows:

  1. Try to use an explicit directory specifically for this webapp:
    • Iff webapp.getTempDirectory() is set, use it. Do NOT delete it on jvm exit.
    • Iff javax.servlet.context.tempdir context attribute is set for this webapp && exists && writeable, then use it. Do NOT delete on jvm exit.
  2. Create a directory based on global settings. The new directory will be called "Jetty_"host""port"'"context""+virtualhost :
    • Iff $(jetty.home)/work exists create the directory there. Do NOT delete on jvm exit. Do NOT delete contents if dir already exists.
    • Iff WEB-INF/work exists create the directory there. Do NOT delete on jvm exit. Do NOT delete contents if dir already exists.
    • Else create dir in $(java.io.tmpdir). Set delete on jvm exit. Delete contents if dir already exists.

Be aware that a temporary directory will have its contents deleted when the webapp is stopped unless either

  • It is called work.
  • It pre-existed the deployment of the webapp.

Once a tempory directory has been allocated, a File instance for it is set and retrievable as the javax.servlet.context.tempdir attribute of the web application.

Back to the top