I have an Android app contacting a REST API developed with Spring. The app serializes well an object but the Spring application parses every field as null when they aren't null. What can be wrong? what shall I do?
This is the REST API method signature: cambioPassword(@RequestHeader("Authorization") String header, PasswordChange userData)
Note: both the app and the API uses Gson (I'm not using Jackson as default in the Spring application)
I've tried every kind of constructor and I've changed the visibility of the Java class fields
public class PasswordChange {
private String name;
private String currentPassword; // Ciphered field
private String newPassword; // Ciphered field
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCurrentPassword() {
return currentPassword;
}
public void setCurrentPassword(String currentPassword) {
this.currentPassword= currentPassword;
}
public String getNewPassword() {
return newPassword;
}
public void setNewPassword(String newPassword) {
this.newPassword = newPassword;
}
}
The server should be able to deserialize the PasswordChange class and the fields should not be null as they aren't in the original sent JSON.