为了账号安全,请及时绑定邮箱和手机立即绑定

该公众号提供的服务出现故障,请稍后再试

该公众号提供的服务出现故障,请稍后再试

qq_光年一夏_0 2018-04-03 09:38:39
protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {     String time;     Date date=new Date();     time=String.valueOf(date.getTime());     PrintWriter out=response.getWriter();     request.setCharacterEncoding("UTF-8");     response.setCharacterEncoding("UTF-8");     try {         Map<String,String> map= MessageUtil.xmlToMap(request);         String fromUserName=map.get("FromUserName");         String toUserName=map.get("ToUserName");         String msgType=map.get("MsgType");         String content=map.get("Content");         String message=null;         if ("text".equals(msgType)){             TextMessage text=new TextMessage();             text.setFromUserNmae(toUserName);             text.setToUserName(fromUserName);             text.setMsgType("text");             text.setCreateTime(time);             text.setContent("您发送的消息是:"+content);             message=MessageUtil.textMessageToXml(text);             System.out.print(message+"\n\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");         }     }catch (DocumentException e){         e.printStackTrace();     }finally {         out.close();     } }控制台返回的消息<xml>   <ToUserName>oNOiOwNQHWc-bAzTfXq0k2GIbntU</ToUserName>   <FromUserNmae>gh_f2e1eb1abb3a</FromUserNmae>   <CreateTime>1522719221085</CreateTime>   <MsgType>text</MsgType>   <Content>您发送的消息是:啊啊啊</Content> </xml>
查看完整描述

目前暂无任何回答

  • 0 回答
  • 0 关注
  • 2530 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信