spring mvc 代码如下:
@PostMapping(value = "/send/tpost/{appName}",produces = "text/plain;charset=UTF-8")
public String sendAppCluster(@PathVariable String appName, @RequestBody Object data) {
return "Ok";
}
@GetMapping("/send/tget")
public String sendEvent(@RequestParam String message) {
publisher.publishEvent(message);
return "Sent";
}
发送post请求
$ curl -X POST http://localhost:8087/send/tpost/app-name -d '{"name":"chy"}'
-H "content-type:application/json;chartset=utf-8"
发送get请求
$ curl -X GET http://localhost:8087/send/tget?message=22222