Skip to main content
Active reading.
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

It worked for me using:

curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":100}' http://localhost/api/postJsonReader.do 

It was happily mapped to the Spring controller:

@RequestMapping(value = "/postJsonReader", method = RequestMethod.POST) public @ResponseBody String processPostJsonData(@RequestBody IdOnly idOnly) throws Exception { logger.debug("JsonReaderController hit! Reading JSON data!"+idOnly.getId()); return "Json"JSON Received"; } 

IdOnly is a simple POJOPOJO with an id property.

It worked for me using:

curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":100}' http://localhost/api/postJsonReader.do 

It was happily mapped to the Spring controller:

@RequestMapping(value = "/postJsonReader", method = RequestMethod.POST) public @ResponseBody String processPostJsonData(@RequestBody IdOnly idOnly) throws Exception { logger.debug("JsonReaderController hit! Reading JSON data!"+idOnly.getId()); return "Json Received"; } 

IdOnly is a simple POJO with id property.

It worked for me using:

curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":100}' http://localhost/api/postJsonReader.do 

It was happily mapped to the Spring controller:

@RequestMapping(value = "/postJsonReader", method = RequestMethod.POST) public @ResponseBody String processPostJsonData(@RequestBody IdOnly idOnly) throws Exception { logger.debug("JsonReaderController hit! Reading JSON data!"+idOnly.getId()); return "JSON Received"; } 

IdOnly is a simple POJO with an id property.

deleted 15 characters in body
Source Link
Ashwini Chaudhary
  • 252.1k
  • 60
  • 478
  • 519

It worked for me using:

 curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":100}' http://localhost/api/postJsonReader.do 

It was happily mapped to the Spring controller:

 @RequestMapping(value = "/postJsonReader", method = RequestMethod.POST)  public @ResponseBody String processPostJsonData(@RequestBody IdOnly idOnly) throws Exception {   logger.debug("JsonReaderController hit! Reading JSON data!"+idOnly.getId());   return "Json Received"; } 

IdOnlyIdOnly is a simple POJO with id property.

It worked for me using:

 curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":100}' http://localhost/api/postJsonReader.do 

It was happily mapped to the Spring controller:

 @RequestMapping(value = "/postJsonReader", method = RequestMethod.POST)  public @ResponseBody String processPostJsonData(@RequestBody IdOnly idOnly) throws Exception {   logger.debug("JsonReaderController hit! Reading JSON data!"+idOnly.getId());   return "Json Received"; } 

IdOnly is a simple POJO with id property.

It worked for me using:

curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":100}' http://localhost/api/postJsonReader.do 

It was happily mapped to the Spring controller:

@RequestMapping(value = "/postJsonReader", method = RequestMethod.POST) public @ResponseBody String processPostJsonData(@RequestBody IdOnly idOnly) throws Exception { logger.debug("JsonReaderController hit! Reading JSON data!"+idOnly.getId()); return "Json Received"; } 

IdOnly is a simple POJO with id property.

Markup/Readability
Source Link
GDP
  • 8.2k
  • 6
  • 48
  • 84

It worked for me using: curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":100}' http://localhost/api/postJsonReader.do

 curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":100}' http://localhost/api/postJsonReader.do 

It was happily mapped to the Spring controller:

 @RequestMapping(value = "/postJsonReader", method = RequestMethod.POST) public @ResponseBody String processPostJsonData(@RequestBody IdOnly idOnly) throws Exception { logger.debug("JsonReaderController hit! Reading JSON data!"+idOnly.getId()); return "Json Received"; } 

IdOnly is a simple POJO with id property.

It worked for me using: curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":100}' http://localhost/api/postJsonReader.do

It was happily mapped to the Spring controller:

 @RequestMapping(value = "/postJsonReader", method = RequestMethod.POST) public @ResponseBody String processPostJsonData(@RequestBody IdOnly idOnly) throws Exception { logger.debug("JsonReaderController hit! Reading JSON data!"+idOnly.getId()); return "Json Received"; } 

IdOnly is a simple POJO with id property.

It worked for me using:

 curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":100}' http://localhost/api/postJsonReader.do 

It was happily mapped to the Spring controller:

 @RequestMapping(value = "/postJsonReader", method = RequestMethod.POST) public @ResponseBody String processPostJsonData(@RequestBody IdOnly idOnly) throws Exception { logger.debug("JsonReaderController hit! Reading JSON data!"+idOnly.getId()); return "Json Received"; } 

IdOnly is a simple POJO with id property.

Source Link
Luis
  • 1.4k
  • 1
  • 11
  • 4
Loading