Temporary Directory

Last modified by Eleni Cojocariu on 2026/04/14 11:24

Explanation

The temporary directory in XWiki is a working folder used to store short-lived data needed during runtime. It is defined by the servlet container through the javax.servlet.context.tempdir property. This property specifies the location of the file system entry that XWiki will use for temporary storage. For XWikii to use this directory, it must have write access to it. Otherwise, XWiki will log warnings or fail to operate correctly, and and attempt to use the java.io.tmpdir System property. If this is not a writable directory, an exception will be thrown.

The temporary directory can be periodically cleaned and all its content deleted, so it must not be used for anything else. What it contains:

  • Cached files (e.g., resized images).
  • Attachments temporarily extracted from the database.
  • Other intermediate data generated during processing.
  • Potentially additional temporary files created by third-party libraries (often also in java.io.tmpdir).

The temporary directory is used mainly for:

  • Improving performance by caching reusable data (like processed images).
  • Supporting runtime operations that require temporary storage (e.g., file transformations or attachment handling).

FAQ

Do all components of XWiki use the same temporary directory?

No, while XWiki uses the temporary directory configured by the servlet container, some third-party libraries may use a different one, for example the tmp dir provided by the JVM, i.e. the location pointed to by the java.io.tmpdir System property. 

Get Connected