On Fri, 2005-08-26 at 16:26 -0400, Ryan Wynn wrote: > I have a portal application and one of the portlets is just 1 jsp page > with an embedded applet. This applet uses java's standard > HttpUrlConnection class to talk to a servlet. The thing is when I make a > HttpUrlConnection within the applet I can see that the connection has > inherited the cookies from the portal. Specifically JSESSIONID, etc. This > is necessary because my servlet is configured with security and somehow > sending the cookies allows the request to pass BASIC authentication and > the servlet to link the getRemoteUser of the servlet request to the userId > of whomever logged into portal. > > Is this something special that the j2se HttpConnection is doing? The > reason that I ask is because I also use HttpClient within the applet. > However, it would not propogate the cookies to the servlet. I had to > provide a dirty workaround. I retrieve the cookies using > HttpUrlConnection and then set them explicity on my HttpClient. > > Does anyone know why I am getting my cookies for free with Sun's > HttpUrlConnection and not with HttpClient? Oh, I also tried using each of > the Cookie policies with HttpClient and none of them caused the cookies to > be inherited. > > Ryan
Ryan, There may be several reasons for this behavior: HttpClient rejects the cookies because it finds them malformed for some reason or HttpClient does not include the cookies in the subsequent requests because it fails to match them to the target URI. Usually it should be possible to tell the cause of the problem by looking at the wire/context log of the HTTP session: http://jakarta.apache.org/commons/httpclient/logging.html Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
