@Override
    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String nonce = req.getParameter("nonce");
        String echostr = req.getParameter("echostr");
        String remoteSig = req.getParameter("signature");
        String timestamp = req.getParameter("timestamp");

        if (StringUtils.isBlank(remoteSig) || StringUtils.isBlank(timestamp) || StringUtils.isBlank(nonce)) return;

        boolean pass = false;
        try {
            pass = WechatSignatureChecker.check(timestamp, nonce, remoteSig);
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }

        if (pass) {
            if (StringUtils.isNotEmpty(echostr)) {
                PrintWriter out = resp.getWriter();
                out.print(echostr);
                closeIO(out);
                return;
            }

            BufferedReader reader = req.getReader();
            String xml = "";
            String s;
            while ((s = reader.readLine()) != null){
                xml += s;
            }
	System.out.println(xml);

        try {
            xml = new String(xml.getBytes("ISO8859-1"), "UTF-8");
            resp.setContentType("text/xml");
            resp.setCharacterEncoding("UTF-8");
            PrintWriter out = resp.getWriter();
            String messageReturn = handleFactory.handle(xml);
            out.write(messageReturn);
            closeIO(out);
        } catch (Exception e) {
            e.printStackTrace();
        }
        }
    }