This is great. This info should be on the first page of the "So, you want to
become a Sling wizard" page in the Wiki :)

Cheers,
PS

On Jan 19, 2008 3:07 PM, Felix Meschberger <[EMAIL PROTECTED]> wrote:

> Hi Peter,
>
> All resources available to JSP are also available to scripts, this is
> not different for JavaScript (Rhino in our case).
>
> For example, each script has the following global objects:
>
>    request - The SlingHttpServletRequest object for the request
>    response - The SlingHttpServletResponse object for the request
>    log - An SLF4J logger for logging
>    resource - The Resource of the request (same as
> request.getResource() or
>                     request.resource in JavaScript lingo)
>    out - The output channel (same as response.getWriter())
>    sling - A SlingScriptHelper instance
>
> >From these objects you should be able to do just about anything ....
>
> Hope this helps.
>
> Regards
> Felix
>
> Am Samstag, den 19.01.2008, 10:26 +0100 schrieb Peter Svensson:
> > Argh! Sorry about this. The resource is indeed referenced. My fault.
>  But
> > still, is there some server-side system files which describe which
> things
> > are accessible from scripts??
> >
> > Cheers,
> > PS
> >
> > On Jan 19, 2008 10:24 AM, Peter Svensson <[EMAIL PROTECTED]> wrote:
> >
> > > Wait - just another question; In most of the tests; esp, erb, et.c.
> there
> > > are magic api references. For instance resource or node, et.c.  In the
> js
> > > example there's only writeln's. Is it possible to access system
> resources
> > > from Rhino as well?  If so, is there some Java system file which
> describes
> > > which resources are accesible to the scripts??
> > >
> > > Thank!
> > >
> > > Cheers,
> > > PS
> > >
> > >
> > > On Jan 19, 2008 10:21 AM, Peter Svensson <[EMAIL PROTECTED]> wrote:
> > >
> > > > WoW!  Thanks. :) I half-and-half that you would say that it was
> > > > theoretically possible, but not on Saturdays :)  This, I like.
> > > >
> > > > Cheers,
> > > > PS
> > > >
> > > >
> > > > On Jan 19, 2008 10:18 AM, Bertrand Delacretaz <
> [EMAIL PROTECTED]>
> > > > wrote:
> > > >
> > > > > On Jan 19, 2008 10:14 AM, Peter Svensson < [EMAIL PROTECTED]>
> wrote:
> > > > >
> > > > > > ...If Sling support writing server-side scripts in Rhino,
> couldn't I
> > > > > just as
> > > > > > well write a serve-side javascript which access internal Sling
> APIs,
> > > > > build
> > > > > > the structure, and outputs the correct format?...
> > > > >
> > > > > Sure - just name your script "json.js", put in in the right place
> > > > > based on the sling:resourceType of the node that you're dumping,
> and
> > > > > that should work if the GET request URL uses the .json extension.
> > > > >
> > > > > There are no docs on this ATM, but the integration tests found
> under
> > > > >
> > > > >
> http://svn.apache.org/repos/asf/incubator/sling/trunk/usling/usling-webapp/src/test
> > > > > contain lots of examples.
> > > > >
> > > > > -Bertrand
> > > > >
> > > >
> > > >
> > >
>
>

Reply via email to