java android,如何发送会话接受? [英] java android, how to send session accept?

查看:65
本文介绍了java android,如何发送会话接受?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要发一个帖子,但服务器检查帖子是否接受了会话,

我需要附加的代码是什么?



这是我的邮政编码的一部分:

 StringEntity entity =  new  StringEntity(xmlSend ,  UTF-8); 
DefaultHttpClient httpClient = new DefaultHttpClient();

HttpPost post = new HttpPost(watchUrl);
post.addHeader( * *);
post.setEntity(entity);

HttpResponse response = httpClient.execute(post);

if (response!= null){
InputStream inputstream = response.getEntity()。getContent();
字符串 xmlGet = StmToStr(输入流);
}



感谢帮助...

解决方案

你必须发送cookie作为请求的一部分。这可能会对你有所帮助。



http ://hc.apache.org/httpcomponents-client-4.3.x/primer.html

I need to send a post, but the server check if the post have accepting for session,
what is the code who i need to attach?

It's part of my post code:

StringEntity entity = new StringEntity(xmlSend, "UTF-8");
DefaultHttpClient httpClient = new DefaultHttpClient();

HttpPost post = new HttpPost(watchUrl);
post.addHeader(" * ", " * ");
post.setEntity(entity);

HttpResponse response = httpClient.execute(post);

if(response != null) {
    InputStream inputstream = response.getEntity().getContent();
    String xmlGet = StmToStr(inputstream);          
}


Thanks for helpers...

解决方案

You have to send the cookie as a part of request. This might help you.

http://hc.apache.org/httpcomponents-client-4.3.x/primer.html


这篇关于java android,如何发送会话接受?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆