Blog About Contact

Where Does Wicket Store It's DiskPageStore Files?

Published Sun, 22 Aug 2010

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.


About the Author

Richard Nichols is an Australian software engineer with a passion for making things.

Follow him on twitter or subscribe by RSS or email.

You might also enjoy reading -


Discuss / Comment

No one has commented yet.

Add a comment

  • {{e.error}}

Thanks for your comment!/

Required.
Valid email address required.
Required.
Posting message, please wait...