[xwiki-users] Page calling itself as JSON source
Hello: I was wondering, if a page calls itself as a JSON provider, is the context preserved? or do I need to pass information to itself in the query string? the way I have it call itself is that, if the query string is empty, it assumes you want to display the page, but if the query string has parameters, it assumes it needs to return JSON. Dan -- View this message in context: http://xwiki.475771.n2.nabble.com/Page-calling-itself-as-JSON-source-tp76002... Sent from the XWiki- Users mailing list archive at Nabble.com.
The context is associated to the request, so if you execute a new HTTP request you get a new context. If you want to pass informations you will have to use query string. That said, request to get a JSON result are already special request because you don't want to end up with the skin: usually you use something like http://mydomain/xwiki/bin/get/MySpace/MyPage?outputSyntax=plain so you could test $xcontext.action == 'get' for example. On Sat, Jul 9, 2016 at 11:55 PM, dullfig <[email protected]> wrote:
Hello:
I was wondering, if a page calls itself as a JSON provider, is the context preserved? or do I need to pass information to itself in the query string?
the way I have it call itself is that, if the query string is empty, it assumes you want to display the page, but if the query string has parameters, it assumes it needs to return JSON.
Dan
-- View this message in context: http://xwiki.475771.n2.nabble.com/Page-calling-itself-as-JSON-source-tp76002... Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne
thanks for the response! that is what I was suspecting. The JSON provider is feeding a live table. I guess the live table macro already takes care of asking for plain output? Dan -- View this message in context: http://xwiki.475771.n2.nabble.com/Page-calling-itself-as-JSON-source-tp76002... Sent from the XWiki- Users mailing list archive at Nabble.com.
Yes the livetable macro uses the kind of URL I indicated. On Sun, Jul 10, 2016 at 6:26 PM, dullfig <[email protected]> wrote:
thanks for the response! that is what I was suspecting. The JSON provider is feeding a live table. I guess the live table macro already takes care of asking for plain output?
Dan
-- View this message in context: http://xwiki.475771.n2.nabble.com/Page-calling-itself-as-JSON-source-tp76002... Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne
participants (2)
-
dullfig -
Thomas Mortagne