Reinis Vicups created TOMEE-514:
-----------------------------------
Summary: JSONProvider - default setting of serializeAsArray is
true, leading to marshaling error in out-of-the-box CXF configuration
Key: TOMEE-514
URL: https://issues.apache.org/jira/browse/TOMEE-514
Project: TomEE
Issue Type: Improvement
Affects Versions: 1.5.1
Reporter: Reinis Vicups
Referring to this thread:
http://openejb.979440.n4.nabble.com/Possible-JSON-bug-in-TomEE-1-5-and-1-5-1-td4658328.html
it appears that the default setting of serializeAsArray is set to true for the
standard CXF JSONParser.
This appears to lead to the situation where even the root-objet of the
marshaled object tree is formatted as an array. The CXF Unmarshaler (not sure
which class is doing this exactly) fails if root object is formatted as an
array (I have experienced this error in the case where my root object was NOT a
collection).
Example:
class MyObject {
String id;
}
is marshaled as (square braces '[' indicate an array):
{"myobjectinstance:[{"id":"12345}]}
and the webmethod "receiving" the MyObject that is formatted with the square
braces will fail:
@Consumes("application/json")
@POST
@Path("/process")
public MyObject process(MyObject myObjectInstance) {
...
}
So solution could be
- to set serializeAsArray to false or
- somehow in other way ensure that single instances in json are formatted as
such,
- or make standard CXF json unmarshaler more tolerant with single instances
formatted as an array.
br
Reinis
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira