客户端cookie不可用时,解决方案
来源:互联网 发布:淘宝 装修市场 编辑:程序博客网 时间:2024/05/18 04:01
String encodeURL(String url)
Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged.
在客户端禁用了cookie后,如果不用这个方法来ecnode一下URL,那么session就无法使用。
加了此方法后会在url后面追加jsession=*******的信息,也就是追加session ID。
jsession:会话cookie的名字
O_Reilly书籍对此问题的建意
I recommend that you take the time to add encodeURL( ) calls for all references up front, even if you know
that all your current users have browsers that support cookies. One day you may want to extend the user
base and lose control over the browsers they use. It's also common that users disable cookies in fear of Big
Brother watching. Yet another reason to prepare for URL rewriting from the beginning is to support new types
of clients that are becoming more and more common, such as PDAs and cell phones. Cookie support in these
small devices is not a given.
知识点扩展:
Java代码 1.protected Session doGetSession(boolean create) 2.{3. …4. // Creating a new session cookie based on that session5. if ((session != null) && (getContext() != null)6. && getContext().getCookies()) 7. {8. Cookie cookie = new Cookie(Globals.SESSION_COOKIE_NAME,9. session.getIdInternal());10. configureSessionCookie(cookie);11. response.addCookieInternal(cookie);12. }13.14. if (session != null) 15. {16. session.access();17. return (session);18. }19. else20. {21. return (null);22. }23.}24.25.protected void configureSessionCookie(Cookie cookie) 26.{27. cookie.setMaxAge(-1);28. String contextPath = null;29. if (!connector.getEmptySessionPath() && (getContext() != null)) 30. {31. contextPath = getContext().getEncodedPath();32. }33. if ((contextPath != null) && (contextPath.length() > 0)) 34. {35. cookie.setPath(contextPath);36. }37. else 38. {39. cookie.setPath("/");40. }41. if (isSecure()) 42. {43. cookie.setSecure(true);44. }45.}
- 客户端cookie不可用时,解决方案
- 【亲测可用】win7下移动硬盘无法访问,拒绝访问位置不可用时的解决方案!
- 新建的vs项目,在debug调试时,断点不可用时的解决方案
- 客户端禁用cookie时session解决方案[转]
- 客户端禁用cookie时session解决方案
- 客户端禁用cookie时session解决方案[转]
- Button不可用时颜色为灰色
- 客户端禁用cookie时session解决方案<转>
- 当出现Magento搜索功能不可用时的处理
- mfc关于CButtonST按钮设置不可用时,按钮变灰
- 关于CButtonST按钮设置不可用时设置按钮图标
- kernel启动控制台还不可用时发生cr…
- kernel启动控制台还不可用时发生cr…
- 当DBCA删除数据库不可用时,手工删除数据库
- c3p0连接池,当数据源不可用时 自动跳过
- php中cal_days_in_month不可用时的替代方法
- 网易客户端cookie操作
- FLEX客户端写cookie
- The fuction of listagg.
- ASP.NET大文件上传
- PC中如何判断网络已经连接或者断开
- 书C#
- test
- 客户端cookie不可用时,解决方案
- SDIO DRIVER
- SVN入门及配置使用
- 常用正则表达式
- 动态调整CDialogBar的停靠位置
- 上下拉电阻知识
- Java JNI深度分析与实践
- c++ beginning(3)
- JS节点操作总结(可以当字典用)