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
+ 304781 Reset HttpExchange timeout on slow request content.
+ 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-910 Allow request listeners to access session
+ JETTY-983 Range handling cleanup

View File

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

View File

@ -171,39 +171,30 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement
_sessionIdManager.start();
// Look for a session cookie name
String tmp=_context.getInitParameter(SessionManager.__SessionCookieProperty);
if (tmp!=null)
_sessionCookie=tmp;
tmp=_context.getInitParameter(SessionManager.__SessionIdPathParameterNameProperty);
if (tmp!=null)
if (_context!=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
if (_maxCookieAge==-1)
{
if (_context!=null)
tmp=_context.getInitParameter(SessionManager.__SessionIdPathParameterNameProperty);
if (tmp!=null)
setSessionIdPathParameterName(tmp);
// set up the max session cookie age if it isn't already
if (_maxCookieAge==-1)
{
String str=_context.getInitParameter(SessionManager.__MaxAgeProperty);
if (str!=null)
_maxCookieAge=Integer.parseInt(str.trim());
tmp=_context.getInitParameter(SessionManager.__MaxAgeProperty);
if (tmp!=null)
_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
if (_sessionPath==null)
{
// only the context initParams
if (_context!=null)
// set up the session domain if it isn't already
if (_sessionDomain==null)
_sessionDomain=_context.getInitParameter(SessionManager.__SessionDomainProperty);
// set up the sessionPath if it isn't already
if (_sessionPath==null)
_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);
//noinspection ConstantIfStatement
if (false)
nextScope(target,baseRequest,request,response);
else if (_nextScope!=null)
if (_nextScope!=null)
_nextScope.doScope(target,baseRequest,request, response);
else if (_outerScope!=null)
_outerScope.doHandle(target,baseRequest,request, response);
@ -203,12 +200,16 @@ public class SessionHandler extends ScopedHandler
//leaving context, free up the session
if (session!=null)
_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.ContinuationListener;
import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.eclipse.jetty.server.session.SessionHandler;
public class AsyncContextTest extends TestCase
{
@ -37,7 +38,11 @@ public class AsyncContextTest extends TestCase
{
_connector = new LocalConnector();
_server.setConnectors(new Connector[]{ _connector });
_server.setHandler(_handler);
SessionHandler session = new SessionHandler();
session.setHandler(_handler);
_server.setHandler(session);
_server.start();
}
@ -245,7 +250,8 @@ public class AsyncContextTest extends TestCase
try
{
Thread.sleep(_resumeAfter);
asyncContext.dispatch();
if(((HttpServletRequest)asyncContext.getRequest()).getSession(true).getId()!=null)
asyncContext.dispatch();
}
catch(Exception e)
{