I didnt understood how it explains to set in json rpc ,i dont have much idea i am new to this
Please check following code URL serverURL = null; try { serverURL = new URL(webURL); } catch (MalformedURLException e) { // handle exception... } JSONRPC2Session mySession = new JSONRPC2Session(serverURL); mySession.getOptions(). int requestID = ID; JSONRPC2Request request = new JSONRPC2Request("authentication", requestID); JSONRPC2Response response = null; try { response = mySession.send(request); } catch (JSONRPC2SessionException e) { System.err.println(e.getMessage()); } if (response.indicatesSuccess()) System.out.println(response.getResult()); else System.out.println(response.getError().getMessage()); } I want to attach my cookie to this request can i do it? On Wed, Nov 2, 2011 at 11:24 AM, Ben H <benhirash...@gmail.com> wrote: > > 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+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en