I am getting 415 Error. This is my mapping used for getting the json response
@RequestMapping(value="/details", method= RequestMethod.POST ,
consumes= MediaType.APPLICATION_JSON_VALUE ,
produces= MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<UserDetails> addUserDetails(@RequestBody
RegisterInput registerInput)throws ValidationException{
if(registerInput==null || registerInput.getUserName()==null){
throw new ValidationException("Input is not valid");
}
UserDetails userDetails=new UserDetails(registerInput.getUserName(),
registerInput.getFirstName(), registerInput.getLastName(), registerInput.getPassword());
userDetailsService.addUserDetails(userDetails);
return new ResponseEntity<UserDetails>(userDetails, HttpStatus.OK);
}
pom.xml
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.4.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.4.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.4.4</version>
</dependency>
Help me with how to get the json response as it says error 415 in my case. Thanks in advance
where UserDetails is the POJO class and RegisterInput is to store the input and return json object. The following is my pom.
Aucun commentaire:
Enregistrer un commentaire