java - How save cookie between request in asyncHttpClient? -


i send 2 request , want second request cookie (cookie response first request).

how work now:

future<response> f = asynchttpclient     .prepareget(url_1)     .execute(); response r = f.get();  /* want code without saving , restoring cookie */ list<cookie> cookies = r.getcookies(); asynchttpclient.boundrequestbuilder b = asynchttpclient.prepareget(url_2) (cookie c : cookies) {   b.addcookie(c); }  f = b.execute(); r = f.get(); 

i want remove complex code, how can it

if using java8 already, comparablefuture may requests sequential run. otherwise, can find useful rxjava third-party (link rxjava in article summary).


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -