I am reading the cookie from the server in my client
application. This I can do. It's using the cookie in
subsequent requests that is failing.
While your thoughts would work on the server-side, it
won't work in my case.
Thanks.
--- "Jan Andresen [elkware]" <[EMAIL PROTECTED]>
wrote:
> Hi Phillip!
>
> What are you acutally trying to do ?
> Read the value of a cookie or set a cookie ?
>
> Get the value of a cookie with:
> Cookie cookies[] = request.getCookies();
> String cookieValue=null;
> if (cookies!=null){
> for (int i=0; i< cookies.length; i++)
> if
> (cookies[i].getName().equals("CookieName"))
> cookieKey=cookies[i].getValue();
> }
> }
>
> set the cookie with:
> Cookie tc = new Cookie("CookieName",cookieValue);
> tc.setMaxAge(maxCookieAge); // int how long the
> cookie should be valid
> response.addCookie(tc);
>
> remeber, you can only read a cookie from the browser
> if you wrote it there
> first, if a different domain/server wrote a cookie,
> you can not read it!
>
> hope this helps..
>
> c.ya Jan
>
> Phillip Rhodes wrote:
>
> > I am writing a java app that accesses a
> cookie-using
> > servlet (the servlet I am communicate with is a
> closed
> > commercial product)
> >
> > I get the cookie via
> > String cookieInfo =
> > connection1.getHeaderField("Set-Cookie");
> >
> > This is what cookieInfo var is...
> > GatewayID=4:967354909482; path=; expires=Fri,
> > 26-Aug-2005 05:41:49 GMT
> >
> > I then create another connection and use the above
> to
> > set the cookie.
> > connection.setRequestProperty("Cookie",temp);
> >
> > I have tried setting temp to
> > 1) the whole string above
> > 2) GatewayID=4:967354909482
> > 3) GatewayID=4:967354909482;
> >
> > Nothing works. I keep getting an error that means
> > that I don't have a session. Any ideas?
> >
> > Thanks,
> > Phillip
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Mail - Free email you can access from
> anywhere!
> > http://mail.yahoo.com/
> >
> >
>
___________________________________________________________________________
> > To unsubscribe, send email to
> [EMAIL PROTECTED] and include in the body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives:
>
http://archives.java.sun.com/archives/servlet-interest.html
> > Resources:
>
http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help:
> http://www.lsoft.com/manuals/user/user.html
>
> --
> Jan Andresen :: New Media Engineer ::
> http://www.elkware.com
> Phone: ++49 (0) 4103 - 12 45 40
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED]
> and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives:
>
http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
>
http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help:
http://www.lsoft.com/manuals/user/user.html
__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html