我想确保我的方法不会修改某些cookie,如PLAY_LASH和PLAY_SESSION(为什么?因为错误785)。
我试过这个:
// This method should never modify any PLAY cookie.
public static void doNothingPost() throws InterruptedException {
logger.info("Done nothing");
response.cookies.remove("PLAY_FLASH");
response.cookies.remove("PLAY_ERRORS");
response.cookies.remove("PLAY_SESSION");
ok();
}
事实证明,respone.cookies.remove()
会主动删除一个cookie(具有过期日期的SetCookie)。我如何告诉play不要为特定cookie发送任何SetCookie标头?(或者全部?)
- t0->调用setSession
- t5->调用doNothing
- t10->setSession返回
-
t15->doNothing返回
public static void setSession(String uuid){ Cache.add(uuid, "guven"); response.setCookie("username", "guven"); await(1000); ok(); } public static void doNothing(String sameUUIDWithSetSessionParameter){ String username = Cache.get(sameUUIDWithSetSessionParameter, String.class); Cache.delete(sameUUIDWithSetSessionParameter); Logger.info("dn: " + username); await(1000); ok(); }
如果这些连续的ajax调用没有不同的会话id,那么忘记uuid参数,只需使用session.getId()
从Cache
中获取值