Thank you. This seems to have worked beautifully. I think this could have been a problem with the ServletExec wanting the cookies on a single header as well.
Thanks again! Anthony On 12/14/05, Oleg Kalnichevski <[EMAIL PROTECTED]> wrote: > > On Wed, Dec 14, 2005 at 09:16:54AM -0500, Anthony Bargnesi wrote: > > Oleg/Michael, > > > > Thanks for your responses. Oleg, for browser compatibility cookie > policy, > > do I use CookieSpecBase.class or some other class? > > > > CookiePolicy.registerCookieSpec(CookiePolicy.BROWSER_COMPATIBILITY, > > > CookieSpecBase.class); > > > > > > HttpMethod method = new GetMethod(); > method.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); > > or > > HttpClient httpagent = new HttpClient(); > httpagent.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); > > For details see: > > http://jakarta.apache.org/commons/httpclient/cookies.html > > Oleg > > > > > > Anthony > > > > > > On 12/14/05, Oleg Kalnichevski <[EMAIL PROTECTED]> wrote: > > > > > > On Tue, Dec 13, 2005 at 04:45:46PM -0500, Michael Becke wrote: > > > > Hi Anthony, > > > > > > > > You will need to force HttpClient to send the cookies as a single > > > header: > > > > > > > > http.protocol.single-cookie-header > > > > at > > > > <http://jakarta.apache.org/commons/httpclient/preference-api.html> > > > > > > > > Mike > > > > > > > > > > And probably use the browser compatibility cookie policy. This will > > > make $Version=0; attribute go away > > > > > > http://jakarta.apache.org/commons/httpclient/cookies.html > > > > > > Oleg > > > > > > > > > > > > > On 12/13/05, Anthony Bargnesi <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > > > > > > > > I am using HtmlUnit to run testcases against my web > application. On > > > the > > > > > login page I do a form post containing the login > > > information. ServletExec > > > > > generates > > > > > a "sesessionid" that is set as a cookie. This obviously works on > a > > > browser > > > > > but using HttpClient for a client does not work. I have examined > the > > > http > > > > > requests > > > > > and responses to get a better idea of what is happening. > > > > > > > > > > The browser does the post: > > > > > > > > > > POST /myaquent?APROC=Login HTTP/1.1 > > > > > > > > > > > > > > > and sets the cookies: > > > > > > > > > > > Set-Cookie: UserType=7 > > > > > > Set-Cookie: UserName=dperez > > > > > > Set-Cookie: storeFilesInUBO=true > > > > > > Set-Cookie: sesessionid=gsr2kEn5BATC8oHBKhcLC6Kf4Eo; path=/ > > > > > > > > > > > > > > > HttpClient does the post (I think...it doesn't explicitly say POST > in > > > the > > > > > Header) > > > > > and sets the cookies: > > > > > > > > > > Set-Cookie: UserType=7 > > > > > > Set-Cookie: UserName=dperez > > > > > > Set-Cookie: storeFilesInUBO=true > > > > > > Set-Cookie: sesessionid=0fWKNFTdZ4wanoGkODbXNNzSOXY; path=/ > > > > > > > > > > > > Cookie accepted: "$Version=0; UserType=7" > > > > > > Cookie accepted: "$Version=0; UserName=dperez" > > > > > > Cookie accepted: "$Version=0; storeFilesInUBO=true" > > > > > > Cookie accepted: "$Version=0; > > > sesessionid=0fWKNFTdZ4wanoGkODbXNNzSOXY; > > > > > > $Path=/" > > > > > > > > > > > > > > > > The Cookie accepted lines add $Version=0 which I am not too sure > why > > > or > > > > > even what that means. > > > > > > > > > > The interesting part is the next request I make for the main > window of > > > the > > > > > webapp. > > > > > > > > > > The browser sends the same cookie values (THIS WORKS): > > > > > > > > > > Cookie: UserType=7; UserName=dperez; storeFilesInUBO=true; > > > > > > sesessionid=gsr2kEn5BATC8oHBKhcLC6Kf4Eo > > > > > > > > > > > > > > > but HttpClient sends them differently (DOES NOT WORK): > > > > > > > > > > > "Cookie: $Version=0; UserType=7 > > > > > > "Cookie: $Version=0; UserName=dperez > > > > > > "Cookie: $Version=0; storeFilesInUBO=true > > > > > > "Cookie: $Version=0; sesessionid=0fWKNFTdZ4wanoGkODbXNNzSOXY; > > > $Path=/ > > > > > > > > > > > > > > > which results in the sessionId being reset on the server and > erroring > > > out > > > > > with an error page > > > > > because the user is no longer seen as logged in. > > > > > > > > > > Is it possible that ServletExec is setting the cookie values again > > > because > > > > > HttpClient is not > > > > > specifying cookies in the right way? How can I debug this or even > > > force the > > > > > the cookies to display > > > > > in the header properlyl? > > > > > > > > > > Thanks, > > > > > > > > > > Anthony Bargnesi > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
