From 97fffb4e6a64f59742541c7427ce8b1ae274d811 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Tue, 29 May 2012 18:06:22 +0200 Subject: [PATCH] 380866 maxIdleTime set to 0 after session migration --- .../org/eclipse/jetty/server/session/AbstractSession.java | 1 + .../jetty/server/session/AbstractSessionMigrationTest.java | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java index 690c917393b..8bc7eb5287f 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java @@ -77,6 +77,7 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI _accessed=accessed; _lastAccessed=accessed; _requests=1; + _maxIdleMs=_manager._dftMaxIdleSecs>0?_manager._dftMaxIdleSecs*1000L:-1; if (LOG.isDebugEnabled()) LOG.debug("new session "+_nodeId+" "+_clusterId); } diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionMigrationTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionMigrationTest.java index ff9b489287a..eb027c16982 100644 --- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionMigrationTest.java +++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionMigrationTest.java @@ -111,11 +111,11 @@ public abstract class AbstractSessionMigrationTest protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(false); - if (session == null) session = request.getSession(true); String action = request.getParameter("action"); if ("set".equals(action)) { + if (session == null) session = request.getSession(true); int value = Integer.parseInt(request.getParameter("value")); session.setAttribute("value", value); PrintWriter writer = response.getWriter(); @@ -125,6 +125,8 @@ public abstract class AbstractSessionMigrationTest else if ("get".equals(action)) { int value = (Integer)session.getAttribute("value"); + int x = ((AbstractSession)session).getMaxInactiveInterval(); + assertTrue(x > 0); PrintWriter writer = response.getWriter(); writer.println(value); writer.flush();