Note that there are some explanatory texts on larger screens.

plurals
  1. POPost nested Json to spring controller
    primarykey
    data
    text
    <p>Well I am trying to retrieve a nested json in spring controller and getting 400 (bad request) error.</p> <p>JSON </p> <pre><code>{"AuthenticationInfo": {"loginId":"243324","password":"xyz"} } </code></pre> <p>Controller </p> <pre><code> @RequestMapping(value = "/login", method = RequestMethod.POST,headers={"Accept=*/*","content-type=application/json"}) @ResponseBody public MySubscriber getSubscriber(@RequestBody MyAuthentication myAuthentication) { LOGGER.log(Level.INFO, "getSubscriber"); System.out.println("getSubscriber method : "+myAuthentication); MySubscriber mySubscriber = helloWebService.getSubscriber(myAuthentication); LOGGER.log(Level.INFO, "mySubscriber : " + mySubscriber); System.out.println( "mySubscriber : " + mySubscriber); return mySubscriber; } </code></pre> <p>MyAuthentication </p> <pre><code>public class MyAuthentication extends AuthenticationInfo { private AuthenticationInfo AuthenticationInfo; public AuthenticationInfo getAuthenticationInfo() { return AuthenticationInfo; } public void setAuthenticationInfo(AuthenticationInfo authenticationInfo) { AuthenticationInfo = authenticationInfo; } @Override public String toString() { return "AuthenticationInfo : "+AuthenticationInfo; } } </code></pre> <p>AuthenticationInfo </p> <pre><code> public class AuthenticationInfo { private String loginId; private String password; public String getLoginId() { return loginId; } public void setLoginId(String loginId) { this.loginId = loginId; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Override public String toString() { return "{ loginId : "+loginId+" || password"+password+"}"; } } </code></pre> <p>The error goes when I fire just simple Json and retrieve it accordingly. The only issue here is a nested structure of the Json</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload