Hi,
If you talk about HttpSession then
javax.servlet.http.HttpSessionListener#sessionDestroyed() is what you
need.
Wicket Session has invilidate(Now)() methods but those are used when a
session expires due to inactivity of the user.
On Fri, Mar 2, 2012 at 12:24 PM, brazz alexander.li...@man.eu wrote:
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
compatibility:
@Override
protected ISessionStore newSessionStore()
{
DiskPageStore store;
try
{
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:
http://apache-wicket.1842946.n4.nabble.com/Get-informed-about-invalidation-of-a-session-td1860497.html#a1860503
What is the best way to delete those file at the end of the session?
Thanks in advance!
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Delete-temporary-files-after-end-of-a-session-tp4438040p4438040.html
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
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org