You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Jochen Kemnade (JIRA)" <ji...@apache.org> on 2013/06/03 10:24:20 UTC

[jira] [Commented] (TAP5-2072) Tapestry "metadata" is not added to XHR response if event handler method return JSONArray

    [ https://issues.apache.org/jira/browse/TAP5-2072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13672889#comment-13672889 ] 

Jochen Kemnade commented on TAP5-2072:
--------------------------------------

Have you actually read the ticket description? I'm not talking about a specific problem that I have but about a generic way to address this issue, to allow users to return a JSONArray from their event handler and have the metadata added anyway. Currently, if you do that, things (like adding alerts or redirecting) might just not work as expected and I'd consider that a flaw. Either, we should come up with a "fix" or just disallow returning a JSONArray from event handlers.
                
> Tapestry "metadata" is not added to XHR response if event handler method return JSONArray
> -----------------------------------------------------------------------------------------
>
>                 Key: TAP5-2072
>                 URL: https://issues.apache.org/jira/browse/TAP5-2072
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.4
>            Reporter: Jochen Kemnade
>
> For event handlers that return JSONObject, there is an entry _tapestry in the response object that contains additional resources or inits that are to be executed before passing the actual data to the success handler function.
> When an event handler method returns JSONArray, the resulting array is passed to the client as it is.
> The actual problem I have is that I want to add an alert init to the response.
> The issue could be addressed by wrapping JSONArray responses in a JSONObject, (e.g. {_tapestry:{...}, data: [...]}) and transforming it back on the client side. Probably, for the sake of consistency, it would even be best to to that with JSONObject responses too (e.g. {_tapestry:{...}, data: {...}}).
> However, that approach would lead to the problem that ResponseWrapper.text (representing an Object) doesn't match ResponseWrapper.json (an Array). By the way, there is also a mismatch between those properties for JSONObject responses that contain a _tapestry property: it is deleted in ResponseWrapper.json but stays in place within ResponseWrapper.text.

--
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