rets.put(COUNT_KEY, "1");
return super.doCallback(dispatchedServletContext, dispatchedRequest, dispatchedResponse, handback);
}
};
DriverResponse response = cb.test(null, dispatcher);
if (response != null)
return response;
// Check that the callback was invoked and the other context really was used with another session
assertEquals("1", req.getSession().getAttribute(CROSS_CTX_TEST_ATTR));
assertEquals("1", rets.get(COUNT_KEY));
String url = resp.renderURL("/", null, null);
return new InvokeGetResponse(url);
}
else if (getRequestCount() == 3)
{
// Check that the sessions retained values between requests
// test-spi-server context
assertEquals("1", req.getSession().getAttribute(CROSS_CTX_TEST_ATTR));
// test-spi-app context
// Map to get data from includes
final Map<String, String> rets = new HashMap<String, String>();
ServletContext appContext = testServlet.getServletContext().getContext("/test-spi-app");
ServletContextDispatcher dispatcher = new ServletContextDispatcher(req, resp, container);
NormalCallback cb = new NormalCallback(appContext, registry.getWebApp("/test-spi-app").getClassLoader())
{
public Object doCallback(ServletContext dispatchedServletContext, HttpServletRequest dispatchedRequest, HttpServletResponse dispatchedResponse, Object handback) throws ServletException, IOException
{
rets.put(CROSS_CTX_TEST_ATTR, (String) dispatchedRequest.getSession().getAttribute(CROSS_CTX_TEST_ATTR));
rets.put(COUNT_KEY, "1");
return super.doCallback(dispatchedServletContext, dispatchedRequest, dispatchedResponse, handback);
}
};
DriverResponse response = cb.test(null, dispatcher);
if (response != null)
return response;
// Check that the callback was invoked and the other context really was used with another session
assertEquals("1", rets.get(COUNT_KEY));