struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: auto reload of message resource and URL-rewrite
Date Wed, 21 Feb 2001 18:09:22 GMT
"Kan Leung, MK" wrote:

> * My 2nd question is about "struts-example". Everytime when I load
> "http://localhost/struts-documentation/", the image is never loaded
> successfully at during first time. I viewed the source it the IMG_SRC is
> "/struts-example/struts-power.gif;jsessionid=nhiizz1yq1". May I know why
> URL-rewrite is invoked for my browser, which cookie capability is
> properly enabled?

I didn't answer the other half of this question in my previous response, so
here is some background on why the URL rewriting takes place (even though
you have cookies enabled).

When a session is first created, the servlet container does not yet know
whether the client browser supports cookies.  Therefore, the only safe thing
to do on that initial response is to send the session id *both* ways (URL
rewriting and a cookie), and see what comes back in on the next request.  If
the cookie does not come back, the container says "aha, this client does not
support cookies, so I will continue to use rewriting".

> The image is loaded successfully when I pressed "reload" on my browser.
> The string ";jsessionid*" is gone.

That is because, on the subsequent request, your browser sent the session id
cookie along.  Therefore, the servlet container knows that you support
cookies, and it stops adding the session ID with URL rewriting.

> --
> Kan LEUNG, M K
> email:
> Digital Empires Company Limited


View raw message