hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Expected null behaviour of cookie.getDomain()/cookie.getPath() ?
Date Tue, 29 Jul 2008 11:20:29 GMT
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


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.


To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org

View raw message