Reputation: 8830
It's been a while since my last Roo project. In 1.1.0 the big news was "Automatic JSON support, including in Spring MVC applications: All domain objects produced by Spring Roo will now include automatic JSON-related methods". But when I make my project and ask for a JSON representation, I get a HTTP error 405. I've tried using the new "json add" command, but that doesn't help. Here's my test project
download accept terms of use
project --topLevelPackage com.saers --projectName testRoo
mongo setup --host localhost --port 27017 --databaseName testRoo
entity mongo --class ~.domain.Person --testAutomatically
field string --fieldName name --notNull
json add --class ~.domain.Person
repository mongo --interface ~.repository.PersonRepository --entity ~.domain.Person
web mvc setup
web mvc scaffold --class ~.domain.PersonController
perform package
Via the web interface I add a person, for instance with ID 24442390004624064781023427713 and then I do a curl to get it as JSON
curl -v -X GET -H 'Accept: application/json' -o - http://localhost:8080/testRoo/people/24442390004624064781023427713
This gives me a 405: "Request method 'GET' not supported"
What am I missing to get JSON support?
Cheers
Nik
Upvotes: 1
Views: 1143
Reputation: 555
Try this instead
curl -i -H "Accept: application/json" http://localhost:8080/testRoo/people/24442390004624064781023427713
Thanks Droidment
Upvotes: 1