Glassfish使用URL重写,即使我没有关闭cookies [英] Glassfish use URL rewriting even though I have not turned off cookies

查看:116
本文介绍了Glassfish使用URL重写,即使我没有关闭cookies的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当Glassfish使用最新的Chrome浏览器并在未关闭Cookie的情况下登录到应用程序时,Glassfish会采取URL重写的原因是什么?任何我已经忘记配置或什么?它随机发生。

解决方案

JSESSIONID是确定用户当前HTTP会话的值。它通常存储在浏览器Cookie(名为JSESSIONID)中,以将请求与服务器上的相应会话对象连接起来。



原始请求中不存在JSESSIONID的原因可能是因为服务器没有机会将其发送回浏览器。使用URL重写(该URL将包含jsessionid)将生成没有当前JSESSIONID cookie的页面上的任何链接(例如使用c:url)。在后面的请求中,在JSESSIONID被存储为浏览器cookie之后,URL重写不会发生。



如果用户的浏览器不支持cookie(或使用cookies已被关闭),URL重写将允许用户通过添加到每个URL的jsessionid连接到同一会话。



但是,如果您想转关闭URL重写,您可以通过在glassfish-web.xml文件中将enableURLRewriting属性设置为false来完成此操作。

 < ; property name =enableURLRewritingvalue =false/> 

您也可以通过确保存在适当的cookie并重定向到更多适当的网址。

What are the reason that Glassfish resorts to URL rewriting when I am using the latest Chrome browser and logging in to the application without having turned off cookies? Anything I have forgotten to configure or what? It happens randomly.

解决方案

The JSESSIONID is the value that determines the current HTTP session for the user. It is typically stored in a browser cookie (named JSESSIONID) to connect requests with the appropriate session object on the server.

The reason why the JSESSIONID is not present in the original request is probably because the server has not had the opportunity to send it back to the browser. Any links on a page (using c:url, for example) without a current JSESSIONID cookie will be generated using URL rewriting (the URL will contain the jsessionid). On subsequnt requests, after the JSESSIONID has been stored as a browser cookie, the URL rewrite does not happen.

If the user's browser does not support cookies (or the use of cookies has been turned off) the URL rewriting will allow the user to keep connecting to the same session by the jsessionid added to each URL.

However, if you want to turn off the URL rewriting, you can do this by setting the enableURLRewriting property to false, in the glassfish-web.xml file

<property name="enableURLRewriting" value="false"/>

You may also have luck removing the URL rewrite by ensuring that the appropriate cookie exists and redirecting to a more appropriate URL.

这篇关于Glassfish使用URL重写,即使我没有关闭cookies的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆