You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Miguel <va...@utilibyte.com> on 2007/02/21 22:35:03 UTC

setURL + addCookie bug?

When I use both setURL and addCookie my servlet does not see the cookie.  Is
this a bug in Cactus?  Could someone else try to replicate it?

Here's my beginXXX test:

    public void beginGetContent(WebRequest webRequest) {
       	webRequest.setURL("localhost", "/xmlserver", "/rest/getcontent",
"/5234", "");
            webRequest.addCookie(new Cookie("localhost","SESSID",SID));
     }

I need to add /5234 to the URL I send my servlet located at
/rest/getcontent.  I also need to add a cookie.  When I do both of these the
servlet does not see the cookie.  When I don't setURL the servlet does see
the cookie.

I was thinking this was a problem with the security domain of the cookie,
which does seem to be enforced (by cactus?).  My servlet is actually running
on localhost:8080, so I tried putting localhost:8080 in setURL's servername
and the Cookie's domain and all the different combinations.  

When I don't setURL and I look at the URL that the servelet receives using
getRequestURL() it says "http://localhost:8080/xmlserver/ServletRedirector".
So I tried putting that in my setURL and it still doesn't work.  But I'm
guessing that that's a symptom of whatever the problem is, i.e.
ServletRedirector somehow has the cookies and when I set my own URL I can't
get to the cookies?