android开发入门教程

android开发入门教程
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

============问题描述============


小弟在做一个客户端的购物车功能,要获取到服务器session中保存的购物车列表,上传了sessionid却依旧没法获取到购物车,代码在下面:
String urlString = "http://192.168.1.128:8080/Pinzhuo04/servlet/ShowCartServlet";
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(
urlString).openConnection();
httpURLConnection.setRequestProperty("cookie", sessionid);
httpURLConnection.setConnectTimeout(5000);
httpURLConnection.setRequestMethod("POST");
if (httpURLConnection.getResponseCode() != -1) {
InputStream inputStream = httpURLConnection.getInputStream();
return XMLparse(inputStream);
}

============解决方案1============


http://blog.csdn.net/chindroid/article/details/7556363
我要啦免费统计