博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HttpServletResponse encodeURL 作用
阅读量:4543 次
发布时间:2019-06-08

本文共 1031 字,大约阅读时间需要 3 分钟。

If your application uses session objects, you must ensure that session tracking is enabled by having the application rewrite URLs whenever the client turns off cookies. You do this by calling the response’s encodeURL(URL) method on all URLs returned by a servlet. This method includes the session ID in the URL only if cookies are disabled; otherwise, it returns the URL unchanged.

The doGet method of ShowCartServlet encodes the three URLs at the bottom of the shopping cart display page as follows:

 

If cookies are turned off, the session is encoded in the Check Out URL as follows:

http://localhost:8080/bookstore1/cashier;jsessionid=c0o7fszeb1

If cookies are turned on, the URL is simply

 
 
在客户端禁止cookie的情况下,将session信息追加到url后,保持session同步。

转载于:https://www.cnblogs.com/lostyue/archive/2012/03/15/2398783.html

你可能感兴趣的文章
out 传值
查看>>
8. 负载均衡算法
查看>>
python把函数作为参数的函数
查看>>
《C++ Primer》之指向函数的指针
查看>>
Java自学笔记(第五天)面向对象--char[]和String--封装--构造函数--this
查看>>
8.6 每日课后作业之递归调用番外篇(迭代器)
查看>>
CodeForces 55D Beautiful numbers(数位dp+数学)
查看>>
PAT甲级——A1048 Find Coins
查看>>
PAT甲级——A1049 Counting Ones
查看>>
PAT甲级——A1050 String Subtraction
查看>>
PAT甲级——A1021 Deepest Root
查看>>
PAT甲级——A1051 Pop Sequence
查看>>
PAT甲级——A1022 Digital Library
查看>>
PAT甲级——A1052 Linked List Sorting
查看>>
PAT甲级——A1026 Table Tennis
查看>>
PAT甲级——A1055 The World's Richest
查看>>
PAT甲级——A1036 Boys vs Girls
查看>>
PAT甲级——A1057 Stack
查看>>
PAT甲级——A1038 Recover the Smallest Number
查看>>
PAT甲级——A1058 A+B in Hogwarts
查看>>