Hi

I'm trying to write a HttpClient 4.x application in which

a) I extract Cookies from a HTTP Response (following an initial HTPP
POST),
b) put the Cookie in the next outgoing request (another HTTP POST
method),
c) get the Cookie(s) from the resulting Response,
d) put the Cookie(s) in the next outgoing Request,
.... etc. until end of my HTTP sequence.

How do I do this in Android's version of HttpClient 4.x ? I think I
need to use Request Interceptors and Response Interceptors. Does
anyone have experience with this ?
I am currently trying

DefaultHttpClient dhc = new DefaultHttpClient() ;

// Response Interceptor to extract Cookies from Responsies and add to
CookieStore
dhc.addResponseInterceptor( new ResponseProcessCookies() );

// Request Interceptor to add  Cookies from CookieStore to outgoing
Requests
dhc.addRequestInterceptor( new RequestAddCookies() );

// Create a HttpPost
HttpPost post1= new HttpPost("some-url-or-other");

// Send first request & get response
HttpResponse rsp1 = dhc.execute( post1 );

//Create second HttpPost
HttpPost post2 = new HttpPost("some-url-or-other");

//Send the seconfd POST and get a response
HttpResponse rsp2 = dhc.execute( post2 );

etc.

BTW Am I able to examine the contensts of the CookieStore ? (If so,
how ?)

Thanks for any pointers
Graeme



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to