Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] HttpClient & session management

Alex,

I don't know what version of jetty you're using, but the
method signature for onResponseHeader for the latest jetty
is not (ByteBuffer,ByteBuffer) but (org.eclipse.jetty.io.Buffer, org.eclipse.jetty.io.Buffer).

Also, in order to get the headers cached as response fields, you
need a constructor on your exchange that will call super(true) (ie
call ContentExchange constructor with (true)).

cheers
Jan


On 04/01/11 00:16, Alex Dean wrote:
I'm trying to use an instance of org.eclipse.jetty.client.HttpClient to write a test case for ActiveMQ (which uses Jetty).

I am able to send basic POST&  GET responses.  The trouble I'm having is that I am unable to access the JESSSIONID which is returned from the server, so I can't maintain my state across multiple requests.

Here's the 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.

I can't find any documentation on how session/cookie management should work with org.eclipse.jetty.client.HttpClient.  Can anyone offer any links or tips on this subject?

thanks,
alex
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users

--
Jan Bartel, Webtide LLC | janb@xxxxxxxxxxx | http://www.webtide.com


Back to the top