Tuesday, November 1, 2011

[android-developers] Re: Fwd: Want to send cookie with Json RPC

On Nov 1, 10:40 pm, kapnk...@gmail.com wrote:
> Can i attach cookie to json rpc object in client side & sent a
> request?
> If yes How?

yes, you can. create an instance of org.apache.http.cookie.Cookie, and
add it to an instance of
org.apache.http.impl.client.BasicCookieStore.BasicCookieStore, then
add that to your BasicHttpContext. then it goes something like this:

AndroidHttpClient client = AndroidHttpClient.newInstance(USER_AGENT);

BasicHttpContext httpContext = new BasicHttpContext();
httpContext.setAttribute(ClientContext.COOKIE_STORE, mCookieStore);

HttpGet request = new HttpGet(url);
HttpResponse httpResponse = client.execute(request, httpContext);

--
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
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate