session之url重写,jsessionid,response.encodeURL("...");

来源:互联网 发布:2017淘宝运费险设置 编辑:程序博客网 时间:2024/05/17 21:04

jsp,servlet: session之url重写,jsessionid,response.encodeURL("...");

encodeURL

java.lang.String encodeURL(java.lang.String url)
Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged. The implementation of this method includes the logic to determine whether the session ID needs to be encoded in the URL. For example, if the browser supports cookies, or session tracking is turned off, URL encoding is unnecessary.

For robust session tracking, all URLs emitted by a servlet should be run through this method. Otherwise, URL rewriting cannot be used with browsers which do not support cookies.

Parameters:
url - the url to be encoded.
Returns:
the encoded URL if encoding is needed; the unchanged URL otherwise.

encodeURL

public java.lang.String encodeURL(java.lang.String url)
通过调用URL中的会话ID对指定的URL进行编码,或者如果编码时不必要的就返回“URL不变”。
参数
url - 需要编码的 url。
返回值:
如果编码是有必要的,就返回编码后的 URL;否则就返回没有经过改变的 URL。

0 0
原创粉丝点击