Session timeout during method execution

Hi,

I have a little complicated issue with HttpSession timeout process. It goes like this.

Lets says, my Web Application session timeout period is 5 minutes.

I made a Http request to server and corresponding Servlet requires more than 5 minutes lets say 10 minutes to complete the business logic.

As we can see in the above case, Session is invalidated before end of business logic execution in Servlet.

I've tried following code to work around the problem but seems to be no luck

Before executing the business logic in a method

int timeoutBackup = session.getMaxInactiveInterval(); (5 minutes)

session.setMaxInactiveInterval(-1);

Business Logic.... (10 minutes)

session.setMaxInactiveInterval( timeoutBackup ); ( 5 minutes )

return;

If i make the next request on same session, I get session invalid exception..

I'm wondering what am i doing wrong here..

Hope you guys can throw some light on what I'm doing wrong

Best Regards,

[1029 byte] By [TimeOUta] at [2007-11-26 16:17:59]
# 1

> Hi,

> I have a little complicated issue with

> HttpSession timeout process. It goes like this.

>

> Lets says, my Web Application session timeout

> period is 5 minutes.

> I made a Http request to server and corresponding

> Servlet requires more than 5 minutes lets say 10

> minutes to complete the business logic.

>

> As we can see in the above case, Session is

> invalidated before end of business logic execution

> in Servlet.

>

> I've tried following code to work around the

> problem but seems to be no luck

>

> efore executing the business logic in a method

>

> int timeoutBackup =

> session.getMaxInactiveInterval(); (5 minutes)

>

> ession.setMaxInactiveInterval(-1);

>

>Business Logic.... (10 minutes)

> session.setMaxInactiveInterval( timeoutBackup

>); ( 5 minutes )

>return;

> i make the next request on same session, I get

> session invalid exception..

> I'm wondering what am i doing wrong here..

>

> Hope you guys can throw some light on what I'm doing

> wrong

>

> Best Regards,

I think calling session.getMaxInactiveInterval() the first time is returning zero, ensure that the default value is set to a valid value in your web.xml

CJ2a at 2007-7-8 22:41:10 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...