Add changeSessionId() method in preparation for servlet-3.1

This commit is contained in:
Jan Bartel 2012-09-06 16:23:46 +10:00
parent 3acf2e65ed
commit 605df36577
1 changed files with 16 additions and 0 deletions

View File

@ -68,6 +68,7 @@ import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.http.MimeTypes;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandler.Context;
import org.eclipse.jetty.server.session.AbstractSessionManager;
import org.eclipse.jetty.util.Attributes;
import org.eclipse.jetty.util.AttributesMap;
import org.eclipse.jetty.util.MultiMap;
@ -1162,6 +1163,21 @@ public class Request implements HttpServletRequest
return _channel.getResponse();
}
/* ------------------------------------------------------------ */
/*
* Add @override when 3.1 api is available
*/
public String changeSessionId()
{
HttpSession session = getSession(false);
if (session == null)
throw new IllegalStateException("No session");
AbstractSessionManager.renewSession(this, session, getRemoteUser()!=null);
return session.getId();
}
/* ------------------------------------------------------------ */
/*
* @see javax.servlet.http.HttpServletRequest#getSession()