On 1/15/06, Deepa Khetan <[EMAIL PROTECTED]> wrote:
>
> Hi!
> My application requires, "per-session cookie" to be enabled on client
> browser. How can i determine in my java code if it is enabled or not!
> Deepa
>
>

There is only one test that is useful for this ... set a cookie on one
response, and see if that cookie comes back in on the subsequent request.
There is absolutely no way to know, from a current request, whether or not
cookies are enabled for *your* webapp.

FYI, this is why a servlet container, when a session is first initiated,
will send the session id out both as a cookie *and* as a path parameter (if
the webapp calls response.encodeURL() as it should).  The container has no
way to know whether client cookies are enabled, so it sends the session id
both ways, and then sees which one comes back on the subsequent request.  If
the session id comes back in a cookie, the container can assume that cookies
are enabled, and it will stop encoding the responses with a path parameter.

Craig McClanahan

Reply via email to