[ 
https://issues.apache.org/jira/browse/OFBIZ-2778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12743217#action_12743217
 ] 

Scott Gray commented on OFBIZ-2778:
-----------------------------------

Yeah I completely agree about the need to remove the json event handler 
clutter, but what I am saying is that perhaps a common component 
view-map/screen/ftl would be the most consistent way to replace those event 
responses.

application controller.xml:
{code}
<request-map uri="markOrderViewed">
    <security https="true" auth="true"/>
    <event type="service" invoke="updateOrderHeader"/>
    <response name="success" type="view" name="json"/>
    <response name="error" type="view" name="json"/>
</request-map>
{code}

common-controller.xml:
{code}
<view-map name="json" type="screen" 
page="component://common/widget/CommonScreens.xml#json" 
content-type="application/x-json"/>
{code}

skipping CommonScreens.xml you get the idea

json.ftl
{code}
{<#list attrMap.keySet() as key>"${key}":"${attrMap[key]?if_exists}"</#list>}
{code}

> Alter Json controller requests to move json behaviour to response (from event)
> ------------------------------------------------------------------------------
>
>                 Key: OFBIZ-2778
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-2778
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Bob Morley
>         Attachments: json.diff
>
>
> I think it would be better to apply the Json behaviour of a controller 
> request to the response and not by having multiple Json event types.  These 
> event types always seem to be a wrapped call to another event type that only 
> adds identical Json behaviour (ie. JsonServiceEventHandler wraps 
> ServiceEventHandler and simply adds a Json string to the response).
> Attached is a patch with this change implemented on the "Mark Viewed" 
> function in Order Manager.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to