Servlet -- encodeURL()とencodeRedirectURLの違い


Tomcat-5.5.23において

public String encodeRedirectURL(String url) {
if (isEncodeable(toAbsolute(url))) {
return (toEncoded(url, request.getSessionInternal().getIdInternal()));
} else {
return (url);
}
}

public String encodeURL(String url) {
String absolute = toAbsolute(url);
if (isEncodeable(absolute)) {
// W3c spec clearly said
if (url.equalsIgnoreCase("")){
url = absolute;
}
return (toEncoded(url, request.getSessionInternal().getIdInternal()));
} else {
return (url);
}
}

ということで、「url.equalsIgnoreCase("")」のチェック以外は特に違いはなさそうです。
引数のURLが空文字でなければ全く同じ動きをするので、基本どちらでもよさそう。
Teedaは、encodeURL()をきっちり呼び出しています(Cookieが無い場合において)。
Cookieがあるかないかは、Request.isRequestedSessionIdFromCookie()で判定。
Tomcat内部でも呼び出しているが、Teedaは明示的に判定しています。