306331 Session manager is kept after call to doScope

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1388 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2010-03-18 11:08:40 +00:00
parent 32a02d38c2
commit f697509af0
5 changed files with 37 additions and 37 deletions

View File

@ -30,6 +30,7 @@ jetty-7.0.2.RC0
+ 304698 org.eclipse.jetty.http.HttpFields$DateGenerator.formatCookieDate() uses wrong (?) date format + 304698 org.eclipse.jetty.http.HttpFields$DateGenerator.formatCookieDate() uses wrong (?) date format
+ 304781 Reset HttpExchange timeout on slow request content. + 304781 Reset HttpExchange timeout on slow request content.
+ 304801 SSL connections FULL fix + 304801 SSL connections FULL fix
+ 306331 Session manager is kept after call to doScope
+ JETTY-776 Make new session-tests module to concentrate all reusable session clustering test code + JETTY-776 Make new session-tests module to concentrate all reusable session clustering test code
+ JETTY-910 Allow request listeners to access session + JETTY-910 Allow request listeners to access session
+ JETTY-983 Range handling cleanup + JETTY-983 Range handling cleanup

View File

@ -1340,6 +1340,7 @@ public class Request implements HttpServletRequest
_requestedSessionId=null; _requestedSessionId=null;
_requestedSessionIdFromCookie=false; _requestedSessionIdFromCookie=false;
_session=null; _session=null;
_sessionManager=null;
_requestURI=null; _requestURI=null;
_scope=null; _scope=null;
_scheme=URIUtil.HTTP; _scheme=URIUtil.HTTP;

View File

@ -171,39 +171,30 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement
_sessionIdManager.start(); _sessionIdManager.start();
// Look for a session cookie name // Look for a session cookie name
String tmp=_context.getInitParameter(SessionManager.__SessionCookieProperty); if (_context!=null)
if (tmp!=null)
_sessionCookie=tmp;
tmp=_context.getInitParameter(SessionManager.__SessionIdPathParameterNameProperty);
if (tmp!=null)
{ {
setSessionIdPathParameterName(tmp); String tmp=_context.getInitParameter(SessionManager.__SessionCookieProperty);
} if (tmp!=null)
_sessionCookie=tmp;
// set up the max session cookie age if it isn't already tmp=_context.getInitParameter(SessionManager.__SessionIdPathParameterNameProperty);
if (_maxCookieAge==-1) if (tmp!=null)
{ setSessionIdPathParameterName(tmp);
if (_context!=null)
// set up the max session cookie age if it isn't already
if (_maxCookieAge==-1)
{ {
String str=_context.getInitParameter(SessionManager.__MaxAgeProperty); tmp=_context.getInitParameter(SessionManager.__MaxAgeProperty);
if (str!=null) if (tmp!=null)
_maxCookieAge=Integer.parseInt(str.trim()); _maxCookieAge=Integer.parseInt(tmp.trim());
} }
}
// set up the session domain if it isn't already
if (_sessionDomain==null)
{
// only try the context initParams
if (_context!=null)
_sessionDomain=_context.getInitParameter(SessionManager.__SessionDomainProperty);
}
// set up the sessionPath if it isn't already // set up the session domain if it isn't already
if (_sessionPath==null) if (_sessionDomain==null)
{ _sessionDomain=_context.getInitParameter(SessionManager.__SessionDomainProperty);
// only the context initParams
if (_context!=null) // set up the sessionPath if it isn't already
if (_sessionPath==null)
_sessionPath=_context.getInitParameter(SessionManager.__SessionPathProperty); _sessionPath=_context.getInitParameter(SessionManager.__SessionPathProperty);
} }

View File

@ -182,10 +182,7 @@ public class SessionHandler extends ScopedHandler
} }
// start manual inline of nextScope(target,baseRequest,request,response); // start manual inline of nextScope(target,baseRequest,request,response);
//noinspection ConstantIfStatement if (_nextScope!=null)
if (false)
nextScope(target,baseRequest,request,response);
else if (_nextScope!=null)
_nextScope.doScope(target,baseRequest,request, response); _nextScope.doScope(target,baseRequest,request, response);
else if (_outerScope!=null) else if (_outerScope!=null)
_outerScope.doHandle(target,baseRequest,request, response); _outerScope.doHandle(target,baseRequest,request, response);
@ -203,12 +200,16 @@ public class SessionHandler extends ScopedHandler
//leaving context, free up the session //leaving context, free up the session
if (session!=null) if (session!=null)
_sessionManager.complete(session); _sessionManager.complete(session);
baseRequest.setSessionManager(old_session_manager);
baseRequest.setSession(old_session); // Leave last session in place
if (old_session_manager!=null )
{
baseRequest.setSessionManager(old_session_manager);
baseRequest.setSession(old_session);
}
} }
} }
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/* /*

View File

@ -25,6 +25,7 @@ import junit.framework.TestCase;
import org.eclipse.jetty.continuation.Continuation; import org.eclipse.jetty.continuation.Continuation;
import org.eclipse.jetty.continuation.ContinuationListener; import org.eclipse.jetty.continuation.ContinuationListener;
import org.eclipse.jetty.server.handler.HandlerWrapper; import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.eclipse.jetty.server.session.SessionHandler;
public class AsyncContextTest extends TestCase public class AsyncContextTest extends TestCase
{ {
@ -37,7 +38,11 @@ public class AsyncContextTest extends TestCase
{ {
_connector = new LocalConnector(); _connector = new LocalConnector();
_server.setConnectors(new Connector[]{ _connector }); _server.setConnectors(new Connector[]{ _connector });
_server.setHandler(_handler);
SessionHandler session = new SessionHandler();
session.setHandler(_handler);
_server.setHandler(session);
_server.start(); _server.start();
} }
@ -245,7 +250,8 @@ public class AsyncContextTest extends TestCase
try try
{ {
Thread.sleep(_resumeAfter); Thread.sleep(_resumeAfter);
asyncContext.dispatch(); if(((HttpServletRequest)asyncContext.getRequest()).getSession(true).getId()!=null)
asyncContext.dispatch();
} }
catch(Exception e) catch(Exception e)
{ {