如何使用Curl将JSON数据从终端/命令行发布到TestSpringREST?
{"value":"30","type":"Tip 3","targetModule":"Target 3","configurationGroup":null,"name":"Configuration Deneme 3","description":null,"identity": "Configuration Deneme 3","version":0,"systemId":3,"active":true}
curl -i \ -H "Accept: application/json" \ -H "X-HTTP-Method-Override: PUT" \ -X POST -d "value":"30","type":"Tip 3"," targetModule":"Target 3","configurationGroup":null,"name":"Configuration Deneme 3","description":null,"identity":"Configuration Deneme 3" ,"version":0,"systemId":3,"active":true \ http://localhost:8080/xx/xxx/xxxx
HTTP/1.1 415 Unsupported Media TypeServer: Apache-Coyote/1.1Content-Type: text/html;charset=utf-8Content-Length: 1051Date: Wed, 24 Aug 2011 08:50:17 GMT
服务器拒绝此请求,因为请求实体的格式不受请求方法()的请求资源的支持。
PUT
@RequestMapping(method = RequestMethod.PUT)public Configuration updateConfiguration(HttpServletResponse response, @RequestBody Configuration configuration) { //consider @Valid tag configuration.setName("PUT worked"); //todo If error occurs response.sendError(HttpServletResponse.SC_NOT_FOUND); return configuration;}
长风秋雁
DIEA
相关分类