//
session = req.getSession();
String id = session.getId();
//
String dispatchedId = (String)container.include(app.getServletContext(), req, resp, new RequestDispatchCallback()
{
@Override
public Object doCallback(ServletContext dispatchedCtx, HttpServletRequest dispatchedReq, HttpServletResponse dispatchedResp, Object handback) throws ServletException, IOException
{
if (dispatchedReq.getSession(false) != null)
{
throw new ServletException("Was not expecting a session to exist");
}
HttpSession dispatchedSession = dispatchedReq.getSession();
dispatchedSession.setAttribute("payload", "foo");
return dispatchedSession.getId();
}
}, null);
//
if (!id.equals(dispatchedId))
{
throw new ServletException("Was expecting session ids to be the same");
}
// Check we find the same value
String payload = (String)container.include(app.getServletContext(), req, resp, new RequestDispatchCallback()
{
@Override
public Object doCallback(ServletContext dispatchedCtx, HttpServletRequest dispatchedReq, HttpServletResponse dispatchedResp, Object handback) throws ServletException, IOException
{
HttpSession dispatchedSession = dispatchedReq.getSession();
return dispatchedSession.getAttribute("payload");
}
}, null);
if (!"foo".equals(payload))
{
throw new ServletException("Was expecting a foo payload instead of " + payload);
}
// Now logout
container.logout(req, resp);
//
payload = (String)container.include(app.getServletContext(), req, resp, new RequestDispatchCallback()
{
@Override
public Object doCallback(ServletContext dispatchedCtx, HttpServletRequest dispatchedReq, HttpServletResponse dispatchedResp, Object handback) throws ServletException, IOException
{
HttpSession dispatchedSession = dispatchedReq.getSession();