Hey Alex, seems like http client should this job automatically
http://hc.apache.org/httpclient-3.x/cookies.html did you try some of this methods? btw. thanks for the effort of creating a test case. Cheers -- Dejan Bosanac ----------------- FuseSource - The experts in open source integration and messaging. Email: dej...@fusesource.com Web: http://fusesource.com Twitter: http://twitter.com/dejanb ActiveMQ in Action - http://www.manning.com/snyder/ Blog - http://www.nighttale.net On Wed, Dec 15, 2010 at 3:46 PM, Alex Dean <a...@crackpot.org> wrote: > On Dec 15, 2010, at 3:02 AM, Dejan Bosanac wrote: > >> Hi Jeff, Alex, >> >> having some kind of test that reproduces the issue would be great. >> It'd be good to add something to the tests Alex already contributed >> >> https://fisheye6.atlassian.com/browse/activemq/trunk/activemq-web-demo/src/main/webapp/test/amq_test.html?r=HEAD >> > > > These tests will be junit, since they're testing MessageListenerServlet. The > trouble I've had in the past, and continue to have, is that I haven't been > able to get the session cookie returned during my tests. > > Here's a test I've worked on : http://pastie.org/1177995 > Here's the output : http://pastie.org/1178030 > > This code shows 2 separate ways I've tried accessing the response headers. > 1. Implementing ContentExchange.onResponseHeader. My callback is never > called, though my other onRequestComplete and onResponseComplete callbacks > are. > 2. Trying to use ContentExchange.getResponseFields(). The returned object is > null. > > I watched port 8080 in wireshark while my test was running, and I did see > that the 'Set-Cookie' header was returned by the server. > http://skitch.com/alexdean/d2g2b/capturing-from-lo0-wireshark > > I am able to send a POST to the servlet, and I do receive a response, but > without the cookie I can't associate my later requests with the subscriptions > I've created in the initial POST. > > If anyone can see what I'm doing wrong, I'd really appreciate some tips or > even a nudge in the right direction. If I could get this working, I could > write a test pretty easily to reproduce the issue we're currently seeing, and > then verify the issue has been fixed. I could also write tests for the > previous patches I've submitted for MessageListenerServlet. > > thanks, > alex