tomcat运行日志
这是方法
```
/**
* 验证微信消息服务器
* @param request
* @param model
* @return
*/
@RequestMapping(value="/getToken")
public @ResponseBody
String getToken(HttpServletRequest request, Model model) {
String property = null;
try {
Properties properties = PropertiesLoaderUtils.loadAllProperties("weixin.properties");
property = properties.getProperty("xiaochengxu.token");
System.out.println(property);
} catch (IOException e) {
e.printStackTrace();
}
String signature = request.getParameter("signature");
System.out.println("signature:------------------"+signature);
String timestamp = request.getParameter("timestamp");
System.out.println("timestamp:------------------"+timestamp);
String nonce = request.getParameter("nonce");
System.out.println("nonce:------------------"+nonce);
String echostr = request.getParameter("echostr");
System.out.println("echostr:------------------"+echostr);
Map<String, String> map=new HashMap<>();
map.put("timestamp", timestamp);
map.put("nonce", nonce);
map.put("token", property);
String sha1 = CheckWxServer.formatUrlMap(map, true, false);//加密后的字符串
System.out.println("sha1:------------------"+sha1);
sha1=CheckWxServer.getSha1(sha1);
System.out.println("sha1:------------------"+sha1);
if(StringUtils.isNotBlank(signature)) {
if(signature.equals(sha1)) {
System.out.println("true:------------------"+sha1);
return echostr;//匹配成功,原样返回 echstr
}else {
System.out.println("false:------------------"+"Unsuccessful match");
return echostr;
}
}
System.out.println("false:------------------"+"Wrong Pram");
return echostr;
}
```
执行的这个
但还是校验失败
是我前面的逻辑错了,还是返回的格式问题,有没有用过消息推送的大神知道?