You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Oleg V Alexeev <go...@penza.net> on 2000/09/13 22:55:59 UTC

strange behavior of link tag..

Hello friends,

 Can anybody explain me strange behavior of link tag? One time it
 generates session id in link, another time it not generates this.
 Why?

-- 
Best regards,
 Oleg                          mailto:gonza@penza.net



Re[2]: strange behavior of link tag..

Posted by Oleg V Alexeev <go...@penza.net>.
Hello Craig,

Thursday, September 14, 2000, 1:36:54 AM, you wrote:

...
CRM> The bottom line -- you will see a session ID added to your links on the
CRM> first request belonging to a session, even if you have cookies enabled.
CRM> After that, they will not appear.
...

Thank you, Craig.


-- 
Best regards,
 Oleg                            mailto:gonza@penza.net



Re: strange behavior of link tag..

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Oleg V Alexeev wrote:

> Hello friends,
>
>  Can anybody explain me strange behavior of link tag? One time it
>  generates session id in link, another time it not generates this.
>  Why?
>

Inside the tag, the code is calling HttpServletResponse.encodeURL() for
you.  So, your question becomes "under what circumstances does
encodeURL() actually modify the URL?"  Here's how Tomcat decides --
other containers are probably similar but not guaranteed to be
identical.

Let's start with the request that creates a session in the first place.
As you are creating the response, the server has no clue whether cookies
are enabled or not, so it sends the session ID *both* ways (rewriting
URLs and as a cookie).  On the next request, the server checks whether
the cookie was returned.  If it was, it says "aha, this client is using
cookies so I can stop using rewriting".  Otherwise, it continues on
using rewriting to maintain session state.

The bottom line -- you will see a session ID added to your links on the
first request belonging to a session, even if you have cookies enabled.
After that, they will not appear.

>
> --
> Best regards,
>  Oleg                          mailto:gonza@penza.net

Craig McClanahan

====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat