I'm using FileUpload to upload several files to the server in
"javax.servlet.context.tempdir" or "java.io.tempdir" (i don't want to store
them in the session because of session size) in order to send them via Email
later in the process. So it's some sort of contactor application. 

My problem is that the files in the temporary directory should only be there
for the period of the session. I just store the pathes to the files in the
session and want to delete them at the end of the session.

Implementing "sessionDestroyed(String sessionId)" in class Application
doesn't work because i don't have access to the session in the context of
the Application. 

I could also overwrite "newSessionStore()" in class "Application",  deliver
my own SessionStore implementation and overwrite method "unbind()" where i
could delete my files but then i would have to copy the code of
"newSessionStore" of class "WebApplication" which would be bad for upwards

        protected ISessionStore newSessionStore()
                DiskPageStore store;
                        store = new DiskPageStore();
                catch (SecurityException e)
                        throw new WicketRuntimeException(
                                "SecurityException occurred while creating 
DiskPageStore. Consider
overriding newSessionStore() in your application and using a PageStore that
doesn't required disk access like: " +
                                        HttpSessionStore.class.getName(), e);
                return new SecondLevelCacheSessionStore(this, store);

This thread recommends a HashMap in the Application class althoug this would
propably work it doesn't seem to be the most elegant solution:


What is the best way to delete those file at the end of the session?

Thanks in advance!

View this message in context: 
Sent from the Users forum mailing list archive at Nabble.com.

To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to