views:

405

answers:

2

Pretty obvious from the title I guess :)

Well, problem is that if user is uploading a big file, his session might timeout in that time. How could I prevent session timeouts?

I am using Struts2 with AjaxUpload.

+1  A: 

Increase the session timeout value on web.xml (is in minutes).

   ...
   <session-config>
      <session-timeout>30</session-timeout> 
   </session-config>
  ...
</web-app>
rodrigoap
+3  A: 

Have another request (in paralel) to the server in intervals smaller than the session timeout.

(This is of course only as long as the upload is not finished.)

e.g. request for an image / URL (existing or missing) using AJAX / Iframe / Image tag every X seconds (if your session timeout is 30, I would try 20 or 15 just to make sure...

Notes: If you request a missing URL / Image you will result in a 404 in the logs and if you request a real URL / Image make sure it is cached and never expires to avoid clogging

Works for us...

Ehrann Mehdan