Where Does Wicket Store It’s DiskPageStore Files?

Wicket stores everything other than the current Page for a given user’s session (by default) in a second-level disk-based session cache.

I’d never looked much into how it worked, until I wanted to know where these files were located.

The answer as it turns out makes a lot of sense – here’s the method that does the work in the DiskPageStore.java -

 private static File getDefaultFileStoreFolder()
    {
        final File dir = (File)((WebApplication)Application.get()).getServletContext()
            .getAttribute("javax.servlet.context.tempdir");
        if (dir != null)
        {
            return dir;
        }
        else
        {
            try
            {
                return File.createTempFile("file-prefix", null).getParentFile();
            }
            catch (IOException e)
            {
                throw new WicketRuntimeException(e);
            }
        }
    }

So by default it tries to use the servlet container’s local context’s temporary location, in a Wicket folder underneath. If that fails it attempts to grab the system’s temporary folder.

For Apache Tomcat, that means a folder under your webapps context in apache-tomcat/work/Catalina/… e.g.

Related posts:

  1. Getting a non-relative (absolute) URL for a Wicket page
  2. Announcing – visural-wicket
  3. Implementing a “Draft Mode” with Apache Wicket Forms
  4. visural-wicket 0.7.0 release with support for Wicket 1.5
  5. Implementing security in Wicket with visural-wicket

This entry was posted in Java, Software Engineering, Wicket and tagged Java, web, wicket. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>