如果有人禁用我的浏览器中的cookie,我怎么可以在java中进行会话? [英] how can i do sessions in java if some one disables cookies in my browser?

查看:643
本文介绍了如果有人禁用我的浏览器中的cookie,我怎么可以在java中进行会话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道,如果有人禁用在我的浏览器中的cookie,然后cookie不工作在我的浏览器,那么我怎么可以在java中进行会话。我编写servlet用于服务器端编程。
那么我的会话如何工作?它如何识别用户?由于JSESSION ID存储在Cookie ...

I like to know if someone disables the cookies in my browser then cookies dont work for my browser then how can I do sessions in java. I am writing servlets for server side programming. Then how does my sessions work? How does it recognize the user? As JSESSION ID is stored in cookies...

推荐答案

请参阅HttpServletResponse encodeURL() encodeRedirectURL()

See HttpServletResponse encodeURL() and encodeRedirectURL().

如果浏览器不支持Cookie,这些函数将重写您的网址以包含会话信息。根据您使用的Java Web框架,这些函数可能会自动调用(只要使用框架的方法编写URL)。

These functions will rewrite your URLs appropriately to include the session information if the browser doesn't support cookies. Depending on what Java web framework you're using, these functions may be called automatically (as long as you use the framework's methods for writing URLs).

请注意,在所有情况下都不是所希望的,因为使得会话ID在链接中可见的安全性和缓存影响。 此页面在这个短小的空间中比我可以更好地总结出问题,并提供了禁用此功能的方式。

Note that this may not be desirable in all cases, due to the security and caching implications of making the session ID visible in the links. This page summarizes the issues much better than I can in this short space, and provides a way to disable this feature.

这篇关于如果有人禁用我的浏览器中的cookie,我怎么可以在java中进行会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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