Laurent Perez wrote:
Hi
I'm using commons httpclient to perform a server side request, triggered by
a client (a real browser).
Once the server side request is done, I'm copying the server client cookies
to the client one using response.addCookie(servercookie) : this works as
expected, my client browser receives the cookies.
However, when this client browser performs another request (same page, same
domain), when I display its cookies from its HttpServletRequest (so the
Cookie is not a commons httpclient one, it's a javax.servlet.http.Cookie),
then cookie.getDomain() and cookie.getPath() are always null ; but
cookie.getName() and cookie.getValue() are ok.
I understand why domain and path could be "treated as null", because if I
receive the cookies name and value, then it means they were transmited for
the correct domain and path, but this still puzzles me : why is
javax.servlet.http.Cookies exposing getters for domain and path if the
returned value is always a null ? Tested on jetty and tomcat.
Hope someone can enlighten me :)
thanks !
laurent
Laurent,
A cookie's path and domain attributes are set to null if they have not
been explicitly set by the origin server (which is often the case). In
this case your application should be using the effective domain / path
values. See the HTTP state management spec for details.
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]