I'm trying to catch a POJO as a post Page, rather than an ajax call (since I'm returning a file in the end and the request is too complex for a GET call).
Basically the POJO looks something like:
@Data public class A { private String a; private String b; private String c; }
@Data public class B { private Integer n; private Map m; }
The controller expects the B item, so something like:
@Controller
public class Controller {
@PostMapping("/url") public HttpEntity getFile(@RequestBody B b) {
return getResponseEntityInformationWhatever(b);
}
}
So the form kind of dynamically generates the "hidden" type fields and tries to submit the form to something like:
Note: I also tried without ' (ie. m[someKEy][a])
Note 2: Every example here I typed manually on SO, the real example is a bit bigger, so please ignore syntax errors.
Is there any native way for spring to pick up this information, or do I have to do it another way?
Currently the requests returns with 415 and the controller doesn't even pick up the request.
Thanks
EDIT
When switching @RequestBody B b with @RequestParam Map params I get appropriate map back. So in this context something like:
{
"n": 3,
"m['someKey']['a']": "foo",
"m['someKey']['b']": "bar",
...
}