Merge remote-tracking branch 'origin/master' into jetty-9.1

This commit is contained in:
Jan Bartel 2013-07-24 16:38:39 +10:00
commit eb126ebaee
1 changed files with 23 additions and 9 deletions

View File

@ -464,16 +464,16 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement
{ {
if (isUsingCookies()) if (isUsingCookies())
{ {
String sessionPath = (_sessionPath==null) ? contextPath : _sessionPath; String sessionPath = (_cookieConfig.getPath()==null) ? contextPath : _cookieConfig.getPath();
sessionPath = (sessionPath==null||sessionPath.length()==0) ? "/" : sessionPath; sessionPath = (sessionPath==null||sessionPath.length()==0) ? "/" : sessionPath;
String id = getNodeId(session); String id = getNodeId(session);
HttpCookie cookie = null; HttpCookie cookie = null;
if (_sessionComment == null) if (_sessionComment == null)
{ {
cookie = new HttpCookie( cookie = new HttpCookie(
_sessionCookie, _cookieConfig.getName(),
id, id,
_sessionDomain, _cookieConfig.getDomain(),
sessionPath, sessionPath,
_cookieConfig.getMaxAge(), _cookieConfig.getMaxAge(),
_cookieConfig.isHttpOnly(), _cookieConfig.isHttpOnly(),
@ -482,9 +482,9 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement
else else
{ {
cookie = new HttpCookie( cookie = new HttpCookie(
_sessionCookie, _cookieConfig.getName(),
id, id,
_sessionDomain, _cookieConfig.getDomain(),
sessionPath, sessionPath,
_cookieConfig.getMaxAge(), _cookieConfig.getMaxAge(),
_cookieConfig.isHttpOnly(), _cookieConfig.isHttpOnly(),
@ -904,43 +904,57 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement
@Override @Override
public void setComment(String comment) public void setComment(String comment)
{ {
if (_context != null && _context.getContextHandler().isAvailable())
throw new IllegalStateException("CookieConfig cannot be set after ServletContext is started");
_sessionComment = comment; _sessionComment = comment;
} }
@Override @Override
public void setDomain(String domain) public void setDomain(String domain)
{ {
if (_context != null && _context.getContextHandler().isAvailable())
throw new IllegalStateException("CookieConfig cannot be set after ServletContext is started");
_sessionDomain=domain; _sessionDomain=domain;
} }
@Override @Override
public void setHttpOnly(boolean httpOnly) public void setHttpOnly(boolean httpOnly)
{ {
if (_context != null && _context.getContextHandler().isAvailable())
throw new IllegalStateException("CookieConfig cannot be set after ServletContext is started");
_httpOnly=httpOnly; _httpOnly=httpOnly;
} }
@Override @Override
public void setMaxAge(int maxAge) public void setMaxAge(int maxAge)
{ {
if (_context != null && _context.getContextHandler().isAvailable())
throw new IllegalStateException("CookieConfig cannot be set after ServletContext is started");
_maxCookieAge=maxAge; _maxCookieAge=maxAge;
} }
@Override @Override
public void setName(String name) public void setName(String name)
{ {
if (_context != null && _context.getContextHandler().isAvailable())
throw new IllegalStateException("CookieConfig cannot be set after ServletContext is started");
_sessionCookie=name; _sessionCookie=name;
} }
@Override @Override
public void setPath(String path) public void setPath(String path)
{ {
if (_context != null && _context.getContextHandler().isAvailable())
throw new IllegalStateException("CookieConfig cannot be set after ServletContext is started");
_sessionPath=path; _sessionPath=path;
} }
@Override @Override
public void setSecure(boolean secure) public void setSecure(boolean secure)
{ {
if (_context != null && _context.getContextHandler().isAvailable())
throw new IllegalStateException("CookieConfig cannot be set after ServletContext is started");
_secureCookies=secure; _secureCookies=secure;
} }