Context context = (Context) container_;
Connector connector = ((Response) response).getConnector();
if (context.getCookies())
{
// set a new session cookie
TomcatCookie cookie = new TomcatCookie(Globals.SESSION_COOKIE_NAME, sessionId);
// JBAS-6206. Configure cookie a la o.a.c.connector.Request.configureSessionCookie()
cookie.setMaxAge(-1);
if (context.getSessionCookie().getPath() != null)
{
cookie.setPath(context.getSessionCookie().getPath());
}
else
{
String contextPath = context.getEncodedPath();
if ("".equals(contextPath))
{
contextPath = "/";
}
cookie.setPath(contextPath);
}
if (context.getSessionCookie().getComment() != null)
{
cookie.setComment(context.getSessionCookie().getComment());
}
if (context.getSessionCookie().getDomain() != null)
{
cookie.setDomain(context.getSessionCookie().getDomain());
}
if (context.getSessionCookie().isHttpOnly())
{
cookie.setHttpOnly(true);
}
if (context.getSessionCookie().isSecure())
{
cookie.setSecure(true);
}
if (connector.getSecure())
{
cookie.setSecure(true);
}
if (trace_)
{
log_.trace("Setting cookie with session id:" + sessionId + " & name:" + Globals.SESSION_COOKIE_NAME);