Reputation: 33
I need to generate a Json response for a POST made with parameters in form data, not in Json.
Example: My request:
curl -X POST -H "Accept: application/json" -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" -F "firstName=Manolete" -F "lastName=Manolón" -F "address=villa arriba" -F "city=meryville" -F "telephone=666666666" -F "homepage=alguna.homepage.es" -F "[email protected]" -F "birthday=1314595427866" "http://localhost:8080/PetClinicRoo/owners"
Current request:
curl -X POST -H "Accept: application/json" -d '{firstName: "Manolete", lastName:"Manolón", address:"villa arriba", city: "Meryville", telephone:"66666666", homepage:"alguna.homepage.es", email:"[email protected]", birthDay: 1314596527943, }' "http://localhost:8080/PetClinicRoo/owners"
I could handwrite the code but this implies getting out of spring roo management all the application web tier, and further modifications wouldn't be automatically made.
Upvotes: 0
Views: 86
Reputation: 33
We have several options:
1.- Use spring roo and then pushing in the methods
Generate all the web tier using spring roo
Pushing-in all the post methods
Modify the response
Inconvenients: once you push-in the methods, spring roo doesn’t manage them, so further modifications woldn’t be made automatically
2.-Handwrite the web tier.
Use spring ro to generate entities
Handwrite the web layer
Inconvenients: implies more work than the previous option.
3.- Extend Spring Roo in order to generate the method automatically.
I think this is our best option because he have a lot of entities.
Upvotes: 0
Reputation: 1973
You can push-in the controller method and you modify it as needed, Spring Roo management will work.
Upvotes: 0