You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Gert Vanthienen <ge...@skynet.be> on 2008/04/15 12:44:43 UTC
Accessing the version history
L.S.,
How can I access a node's version history in ESP? Right now, I have...
<% history = currentNode.getVersionHistory();
out.println(history);
versions = history.getAllVersions();
out.println(versions); %>
The first println shows a VersionHistory object instance, but the
subsequent call to getAllVersions() yields a
"org.mozilla.javascript.EcmaError: TypeError: getAllVersions is not a
function, it is org.mozilla.javascript.Undefined."
Shouldn't I be able to access a standard Java object from within the ESP
or do I have to add another ScriptableXyz class to get this done?
Thanks in advance,
Gert
Re: Accessing the version history
Posted by Bertrand Delacretaz <bd...@apache.org>.
On Tue, Apr 15, 2008 at 2:05 PM, Bertrand Delacretaz
<bd...@apache.org> wrote:
> ...the easiest way might be for
> SlingWrapFactory to have a list of interfaces that must be wrapped by
> the default wrapper instead of our custom ones, and include
> VersionHistory in that list....
If you want to try that, of course, patches are welcome!
-Bertrand
Re: Accessing the version history
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,
On Tue, Apr 15, 2008 at 12:44 PM, Gert Vanthienen
<ge...@skynet.be> wrote:
> How can I access a node's version history in ESP? Right now, I have...
> <% history = currentNode.getVersionHistory();
> out.println(history);
> versions = history.getAllVersions();
> out.println(versions); %>
>
> The first println shows a VersionHistory object instance, but the
> subsequent call to getAllVersions() yields a
> "org.mozilla.javascript.EcmaError: TypeError: getAllVersions is not a
> function, it is org.mozilla.javascript.Undefined."...
What you're doing is correct, this looks like a bug - I have created
SLING-382 to fix it, but I won't have time right now.
I'm not sure how best to fix it - the easiest way might be for
SlingWrapFactory to have a list of interfaces that must be wrapped by
the default wrapper instead of our custom ones, and include
VersionHistory in that list.
-Bertrand