java - Support Jackson @JsonFilter async DeferredResult -
base on jira
i have method:
val innerresult: deferredresult[object] = new deferredresult[object]() override def setresult(result: t): boolean = { val beanpropertyfilter: simplebeanpropertyfilter = filter.size match { case 0 => simplebeanpropertyfilter.serializeall() case _ => simplebeanpropertyfilter.filteroutallexcept("id") } val filterprovider = new simplefilterprovider() .addfilter("propertiesfilter", beanpropertyfilter) val wrapper = new mappingjacksonvalue(result) wrapper.setfilters(filterprovider) innerresult.setresult(wrapper) }
in response see this:
{"headers":{}, "body":[{"id":"573080b50ccded33e08da678"}], "statuscode":"ok"}
while want see:
[{"id":"573080b50ccded33e08da678"}]
what doing wrong?
i don't know scala , have trouble following code (where result
defined?). perhaps add method declaration , fix indentation?
in case, seem json representation of whole response instead of response body. in java, responseentity
class has following attributes:
headers
: response headers (cache-control, etc.)statuscode
: response status (200 ok, 404 not found, etc.)body
: response body (an array single object id field in case)
this part seems fishy:
val wrapper = new mappingjacksonvalue(result) innerresult.setresult(wrapper)
it looks you're taking result (body, header, statuscode) , storing in innerresult. based solely on variable names, seems backwards.
Comments
Post a Comment