Item10103: Inconsistent rendering of INCLUDEd topic via rest handler
Priority: Normal
Current State: Closed
Released In: n/a
Target Release: n/a
I've created a number of topics which take advantage of AJAX and use this Plugin.
It's not complicated, certain links when clicked dynamically %INCLUDE pieces from other topics.
This work is done within a separate web from Main called Screens. However, it appeared to me that my INCLUDEd (via tag rest handler) content was being rendered from a Main context. This is because certain WikiWords were recognised as being from Main, but not WikiWords from Screens. The obvious solution was to pass a parameter of web=Screens. However, the Screens WikiWords were now recognised, but I also had content returned like this:
Screens.IF Screens.YOU Screens.DO Screens.NOT Screens.HAVE Screens.ENOUGH Screens.ROOM Screens.ON Screens.ADDRESS |
Screens.LINE Screens.ONE Screens.FOR Screens.THE Screens.CUSTOMER'S Screens.APARTMENT |
Screens.NUMBER, Screens.TYPE Screens.IT Screens.ON Screens.THIS Screens.LINE. Screens.USE Screens.THIS |
All the words (which are in CAPS from an external source) are prefixed with 'Screens.' presumably in an attempt to resolve them as acronyms, but when they fail are left as-is.
I have 'fixed' this by adding my own rest handler (copy of restTag) into
RenderPlugin with this crucial line of code added just after rest handler subroutine entry.
$session->{webName} = 'Screens';
I note that in general a rest handler is called like //foswiki/rest/Plugin/tagname and not //foswiki/rest/Web/Plugin/tagname which means that in general they default to Main and Webhome. I do not know if this points to a deeper issue.
--
JulianLevens - 01 Dec 2010
Julian, what is the
exact url of the REST call?
Most probably you've forgotten to add an urlaprameter
topic=Web.Topic
to it. That's the official way to set the location which rendering during REST calls is relate to.
--
MichaelDaum - 02 Dec 2010
Michael, thanks very much for the feedback. That was indeed the solution. However, a small enhancement to the docs would have saved me quite some grief. Just a link within
RenderPlugin to
CommandAndCGIScripts#rest would have been a great help. This is especially true in that the rest script can only gain this info by an explicit topic= whereas most scripts it's standard to have script/Web/Topic?otherparms, and I was stuck with a faulty assumption in my head.
A search for 'rest handler' brings up quite a few hits and it's not obvious which is the best choice without some Foswiki experience, which to be fair I have enough now and I probably should have found this myself, but whoever follows will be grateful to have a link.
--
JulianLevens - 02 Dec 2010
Closing for inactivity.
--
MichaelDaum - 14 Oct 2013