On Tue, 13 Mar 2001, Rajan Gupta wrote:

> Hi! All,
> The mail reader documentation suggests that html:link encodes the session
> id with the link if the browser has turned off cookies. What does it mean
> by saying
> "Automatically URL-encodes hyperlinks as needed"
> 
> Does it depend upon if cookies are enabled or not? But I could not see
> that in the code, I think it always encodes the url regardless.
> 
> Any insight on this or I am missing something?
> 

It is a clumsy way of saying that Struts always calls
response.encodeURL() or response.encodeRedirectURL() for you.

Whether the session ID actually shows up in the generated hyperlink or not
depends on whether the servlet container thinks your client has cookies
enabled or not.  On the first response that is part of the session, the
container has no way to know - so it sends the session ID both ways (as a
cookie and in the URL).  If the second request contains the session
cookie, the container says "aha, this client supports cookies" so it stops
modifying the generated URLs on hyperlinks.  The call to
response.encodeURL() is still happening; it is just returning the URL
without modifying it.

See the Servlet Specification, version 2.2, for more information about how
session tracking works.

        http://java.sun.com/products/servlet/download.html


> Thanks
> Rajan
> 

Craig McClanahan

Reply via email to