You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Philip Weaver <ph...@gmail.com> on 2008/08/11 03:22:28 UTC

Evaluating Sling: Questions

I want to use sling via REST URL interaction with little configuration.

1. Does Sling indeed have Rhino embedded? In the 15 minute guide, I see .esp
files cited as ECMAScript - however the <% %> syntax makes it look like JSP
- Are the .esp files purely Javascript? Is the full Sling API exposed to
this Javascript?
2. Via a URL query, how does one request a revision?
3. Via a URL query, how does one retrieve an index child nodes available at
a particular node?

Thank you,
Phil

Re: Evaluating Sling: Questions

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Philip

Philip Weaver schrieb:
> I want to use sling via REST URL interaction with little configuration.

Great ! Enjoy.

> 
> 1. Does Sling indeed have Rhino embedded? In the 15 minute guide, I see .esp
> files cited as ECMAScript - however the <% %> syntax makes it look like JSP
> - Are the .esp files purely Javascript? Is the full Sling API exposed to
> this Javascript?

Yes, Sling comes with Rhino as its JavaScript implementation. In 
addition to plain JavaScript files (names end in .ecma to not confuse 
them with the extension .js used for client side JavaScript) templating 
is supported.

Templating works similar to JSP and is indicated by the file extension 
.esp. In particular the syntaxes <% %>, <%= %> and <%!-- %> are 
supported. Taglibs are not supported right now. We call these scripts 
ESP for ECMAScript Server Pages in analogy to JSP for Java Server Pages.

> 2. Via a URL query, how does one request a revision?

You mean a particular JCR Version of a requested node ? Such a thing is 
not currently implemented.

One solution for such a support would be using parametrized URLs of the 
form http://host/some/path.html;v=123. Here the ResourceResolver would 
recognize the "v" parameter and try to access the version "123" for the 
resolved node.


> 3. Via a URL query, how does one retrieve an index child nodes available at
> a particular node?

What exactly do you mean by "index child nodes" ?

Are you talking about Same Name Sibblings (SNS) ? In this case you just 
include the index in the path as in http://host/some/sns[3].html.


Regards
Felix