I'm using Jersey to post some entities to a remote REST service through json, here is the client:
Invocation invocation = buildingWebTarget.request(MediaType.APPLICATION_JSON).
buildPut(Entity.json(tmpEntity));
at the other side I receive the entity but with all fields set to null. The tmpEntity has no null fields so I'm trying to debug what Entity.json() does, is there a way to print as String the result of Entity.json()??
Using
log.info(Entity.json(tmpEntity).toString())
only returns gibberish.
PS:
My tmpEntity is like:
@XmlRootElement
@Entity
public class City implements Serializable
{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String name;
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
}