I have a Java Backend responding rest request with response with this class:
import java.util.Collection;
import java.util.Collections;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.codehaus.jackson.map.annotate.JsonSerialize;
@XmlRootElement
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class RestResponse<T> {
@XmlElement(name = "METADATA")
private JsonMetadata jsonMetadata;
private Collection<T> result;
public RestResponse() {
jsonMetadata = new JsonMetadata();
}
public RestResponse(JsonMetadata metadata) {
this.jsonMetadata = metadata;
}
public JsonMetadata getJsonMetadata() {
return jsonMetadata;
}
public void setJsonMetadata(JsonMetadata jsonMetadata) {
this.jsonMetadata = jsonMetadata;
}
public Collection<T> getResult() {
return result;
}
public void setResult(Collection<T> result) {
this.result = result;
}
public void setObjectList(Collection<T> objectList) {
if (objectList != null) {
this.result = objectList;
}
}
public void setObject(T object) {
if (object != null) {
setObjectList(Collections.singletonList(object));
}
}
public void setErrorMessage(String msg) {
jsonMetadata.setErrorMessage(msg);
}
public void setWarnMessage(String msg) {
jsonMetadata.setWarnMessage(msg);
}
}
And works ok sending something like this:
METADATA: {STATUS: "0", ERROR_MESSAGE: ""}
result: [{id: "4010", name: "Demo"}]
Now I'm trying to use Apache Syncope and want to use maven artifact like read hear:
https://syncope.apache.org/docs/reference-guide.html#client-library
but when I add this lines:
<dependency>
<groupId>org.apache.syncope.client</groupId>
<artifactId>syncope-client-lib</artifactId>
<version>2.1.2</version>
</dependency>
To the pom.xml in my proyect in Eclipse. Only add this lines, Do not do anything else, and then the rest response changes to:
jsonMetadata: {status: "0", errorMessage: ""}
result: [{id: "4010", name: "Demo"}]
For me is a problem because I manage the errors whit this 'METADATA' word.
Does anyone know why this change occurs?