首页 > 代码库 > android 客户端(非浏览器)怎么与服务器session保持同步会话

android 客户端(非浏览器)怎么与服务器session保持同步会话

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


小弟在做一个客户端的购物车功能,要获取到服务器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

android 客户端(非浏览器)怎么与服务器session保持同步会话