Jetty Logo
Contact the core Jetty developers at www.webtide.com

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery

DRAFT

This page contains content that we have migrated from Jetty 7 or Jetty 8 documentation into the correct format, but we have not yet audited it for technical accuracy in with Jetty 9. Be aware that examples or information contained on this page may be incorrect. Please check back soon as we continue improving the documentation, or submit corrections yourself to this page through Github. Thank you.

Chapter 34. Frequently Asked Questions

Table of Contents

There are a number of frequently asked questions that we get. These are many of them.

Temporary Directories

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:

  • Try to use an explicit directory specifically for this webapp:

    • If and only if webapp.getTempDirectory() is set, use it. Do NOT delete it on jvm exit.

    • If and only if 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_"host""port"'"context""+virtualhost :

    • If and only if $(jetty.home)/work exists create the directory there. Do NOT delete on jvm exit. Do NOT delete contents if dir already exists.

    • If and only if 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.

See an error or something missing? Contribute to this documentation at Github!