now I want to get a content-type=application/json callback data. Oddly enough, I can"t get the data using @ RequestBody, as shown in the following code:
@Data
public class BaiduDocNofityResponse {
private String messageId;
private String messageBody;
private String notification;
private String server;
private String subscriptionName;
private String version;
private String signature;
}
@PostMapping("/doc/notify")
public void notify(@RequestBody BaiduDocNofityResponse response){
log.info(":");
log.info(response.toString());//****
}
but if you replace it with the following code, you can get it:
@PostMapping("/doc/notify")
public void notify(HttpServletRequest request) throws IOException {
log.info("request content-type=" + request.getContentType());
log.info(":" + request.toString());
InputStream is = request.getInputStream();
String val = StreamUtil.inputStream2String(is, "UTF-8");
log.info(val);//****
}
does anyone know why?