Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JsonSelectorView not working with POST method and @RequestBody input parameter in Spring #248

Open
get2parag opened this issue Oct 28, 2015 · 0 comments

Comments

@get2parag
Copy link

While running Yoga on a spring boot application using yoga-springmvc & yoga-core lib v1.06, I faced this issue where the response returned by JsonSelectorView was always coming as empty like "{}" in case of a POST method which is taking an input with @RequestBody spring annotation.
Details:-
I tried it with a very simple POJO having a @core annotation over a prepopulated spring attribute.

The API / Controller (& NOT @RestController as suggested) details were like this:-
@RequestMapping((value = "/data", method = RequestMethod.POST)
public TestDTO getData( @RequestBody DataRequestDTO dataReq)

The yoga config was done as exactly mentioned here : https://github.com/skyscreamer/yoga/wiki/Tutorial:-SpringMVC

The same method starting giving result after removing the @RequestBody annotation while taking entity as input through POST method.
I could verify the same by debugging yoga where in while rendering the jsonview the model was showing the type as input request dto instead of the out going test dto and value as empty.
Not sure like @ResponseBody-which is prohibited to be used by Yoga, @RequestBody is also messing with the view rendering or if it is a known issue.
Let me know if more info is required around the config or POJOs to reproduce this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant