[
https://issues.apache.org/jira/browse/OFBIZ-12621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17542031#comment-17542031
]
ASF subversion and git services commented on OFBIZ-12621:
---------------------------------------------------------
Commit 4e30052c8aa13df5710ad031887a191630356440 in ofbiz-framework's branch
refs/heads/release22.01 from Nicolas Malin
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=4e30052c8a ]
Fixed: Json response failed when element not serializable (OFBIZ-12621)
When you forward a request-map on json response after a service call like this :
<request-map uri="updateMyEntity">
<security https="true" auth="true"/>
<event type="service" invoke="serviceWithUnserializableElement"/>
<response name="success" type="request" value="json"/>
<response name="error" type="request" value="json"/>
</request-map>
The request json works fine if the serviceWithUnserializableElement have an
element unserializable on out put at the first level
<service name="serviceWithUnserializableElement"...>
<attribute name="outputStream" type="java.io.OutputStream" mode="OUT"/>
</service>
If the definition is like this
<service name="serviceWithUnserializableElement"...>
<attribute name="outputStreamMap" type="Map" mode="OUT"/>
</service>
The json failed to generate if the outputStream is a map. despite the function
UtilHttp.getJSONAttributeMap that safe only the first map level and don't work
in deep.
By the way, we improved the getJSONAttributeMap to work in deep by a recursive
treatment on Map and List.
> Json response failed when element not serializable
> --------------------------------------------------
>
> Key: OFBIZ-12621
> URL: https://issues.apache.org/jira/browse/OFBIZ-12621
> Project: OFBiz
> Issue Type: Bug
> Components: framework/webapp
> Affects Versions: 22.01.01, Upcoming Branch
> Reporter: Nicolas Malin
> Assignee: Nicolas Malin
> Priority: Major
> Labels: json, webapp
> Attachments: OFBIZ-12621.patch
>
>
> When you forward a request-map on json response after a service call like
> this :
>
> {code:java}
> <request-map uri="updateMyEntity">
> <security https="true" auth="true"/>
> <event type="service" invoke="serviceWithUnserializableElement"/>
> <response name="success" type="request" value="json"/>
> <response name="error" type="request" value="json"/>
> </request-map>
> {code}
> The request json works fine if the serviceWithUnserializableElement have an
> element unserializable on out put at the first level
> {code:java}
> <service name="serviceWithUnserializableElement"...>
> <attribute name="outputStream" type="java.io.OutputStream"
> mode="OUT"/>
> </service>
> {code}
> If the definition is like this
> {code:java}
> <service name="serviceWithUnserializableElement"...>
> <attribute name="outputStreamMap" type="Map" mode="OUT"/>
> </service>{code}
> The json failed to generate if the outputStream is a map en
> try here :
> {code:java}
> CommonEvents.jsonResponseFromRequestAttributes:
> JSON json = JSON.from(attrMap);
> writeJSONtoResponse(json, request, response);
> {code}
> Despite the function UtilHttp.getJSONAttributeMap that safe only the first
> map level and don't work in deep.
>
>
--
This message was sent by Atlassian Jira
(v8.20.7#820007)