[Tomcat, HTTPD, Servlets & JSP] - Session timeout during method execution
by muni78
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,
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4006683#4006683
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4006683
19 years, 2 months
[Tomcat, HTTPD, Servlets & JSP] - Re: What does
by rajrsingh
What was the solution? I have the same problem.
I have a dead simple web.xml:
<web-app>
| <display-name>UMI</display-name>
| <description>UMI web service interfaces</description>
| <servlet>
| <servlet-name>TEST</servlet-name>
| <servlet-class>org.rajsingh.umi.service.client.BasetableService</servlet-class>
| </servlet>
| <servlet-mapping>
| <servlet-name>TEST</servlet-name>
| <url-pattern>/test</url-pattern>
| </servlet-mapping>
| </web-app>
and a very basic test servlet:
public class BasetableService extends HttpServlet {
| @Override
| protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
| doXMLResponse("<msg><content>Hello EJB!</content></msg>", res);
| }
|
| public static void doXMLResponse(String xml, HttpServletResponse res) throws IOException {
| res.setContentType("text/xml");
| res.getWriter().write(xml);
| res.getWriter().close();
| }
| }
and here's the war file listing:
META-INF/
META-INF/MANIFEST.MF
org/
org/rajsingh/
org/rajsingh/umi/
org/rajsingh/umi/service/
org/rajsingh/umi/service/BasetableService.class
WEB-INF/
WEB-INF/web.xml
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4006682#4006682
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4006682
19 years, 2 months