订单推送代码

  //请求URL
  String url = "xxxx";
  //获取请求POST PostMethod post
= new PostMethod(url);
//推送的内容 post.setParameter(
"content", sw.toString());
  //设置请求头 post.setRequestHeader(
"Content-type","application/x-www-form-urlencoded;charset=utf-8");
  //获取httpClient HttpClient httpClient
= new HttpClient();
//设置请求超时时间 httpClient.setTimeout(
10000);
  //发送请求
httpClient.executeMethod(post);
//获取请求返回结果 String body
= post.getResponseBodyAsString();
  //判断结果处理

 

 

 

posted @ 2016-10-10 09:11  简单生活简单乐  阅读(645)  评论(0编辑  收藏  举报