如何防止 Struts2 将 jsessionid 附加到 URL(在重定向时)?
我想将 jsessionid 参数保留在 Struts 生成的 URL 之外,但似乎找不到配置参数或类似参数。说实话,我什至不知道这是在哪个级别处理的。
具体来说,Struts(或 servlet 引擎)在使用 302 进行重定向并且之前尚未建立会话时,会在 URL 中放置一个 sessionid(即,重定向是为了响应未发送 Cookie
的请求)标题)。响应还包含 Set-Cookie
标头。
一般来说,我只是不想在 URL 中包含会话 ID。没有cookie,没有会话。
I want to keep the jsessionid parameter out of the URLs generated by Struts, but can't seem to find a configuration parameter or similar. To be honest, I don't even know exactly at which level this is handled.
Specifically, Struts (or the servlet engine) puts a sessionid in the URL when it's redirecting with a 302 and the session has not been established before (i. e. the redirect is in response to a request that sent no Cookie
header). The response also contains a Set-Cookie
header.
Generally, I just don't want the session id in the URL, ever. No cookies, no session.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试检查您的 servlet 容器提供了什么来解决此问题。或者,您可以编写一个过滤器来删除 jsessionid。请查看此处了解详细信息:http://seamframework.org/Documentation/RemovingJSESSIONIDFromYourURLsAndFishingScache
You can try to check what's your servlet container offers to solve this problem. Alternatively you can write a filter to get rid of jsessionid. Hae a look here for details: http://seamframework.org/Documentation/RemovingJSESSIONIDFromYourURLsAndFixingScache