I have a REST WS to update a bean object which receives a JSON string as input.
ABean entity = svc.findEntity(...);
objectMapper.readerForUpdating(entity).readValue(json);
[...]
svc.save(entity);
ABean is a complex type containing also other objects e.g.:
class ABean {
public BBean b;
public CBean c;
public String d;
}
svc.save(...) will save the bean and the embedded objects.
For security reasons I want to filter out some of the properties that can be updated by the JSON string, but I want to do this dynamically, so that for every WS (or user Role) I can decide which properties to prevent to be updated (so I can't simply use the Jackson Views)
To summarize, is there any way I can dynamically filter out properties during JSON Deserialization?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…