From 8512a9d0a9b71aae06347c0928ece0ef2e4ff6a5 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Mon, 14 May 2018 17:30:24 +0800 Subject: [PATCH] add mailgun notify --- .../system/web/MailCallBackController.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/main/java/au/com/royalpay/payment/manage/system/web/MailCallBackController.java diff --git a/src/main/java/au/com/royalpay/payment/manage/system/web/MailCallBackController.java b/src/main/java/au/com/royalpay/payment/manage/system/web/MailCallBackController.java new file mode 100644 index 000000000..f6a449ba4 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/system/web/MailCallBackController.java @@ -0,0 +1,40 @@ +package au.com.royalpay.payment.manage.system.web; + +import org.apache.commons.io.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import java.io.IOException; + +import javax.servlet.ServletInputStream; +import javax.servlet.http.HttpServletRequest; + +@RestController +@RequestMapping(value = "/mailgun/") +public class MailCallBackController { + Logger logger = LoggerFactory.getLogger(getClass()); + @RequestMapping(value = "/callback", method = RequestMethod.POST) + public void contractList(@RequestBody String content, HttpServletRequest req) { + logger.info("kira"+content); + logger.info(content); + + int len = req.getContentLength(); + ServletInputStream iii = null; + try { + iii = req.getInputStream(); + byte[] buffer = new byte[len]; + iii.read(buffer, 0, len); + logger.info("kiratest"+new String(buffer,"UTF-8")); + IOUtils.closeQuietly(iii); + + } catch (IOException e) { + e.printStackTrace(); + } + + + } +}