You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Peter Svensson <ps...@gmail.com> on 2008/01/19 10:46:32 UTC

esp script not parsing

HI again,

now I've copied one of the esp examples info a file (called 'foo.esp'), and
when I access it in my usling installation, I just get the text of the file.
Is there something else that needs to be done, to enable esp parsing on the
server?

---

<%-- ESP template example, store this as html.esp --%>
<html>
<body>
<p>This page is generated from an ESP template!</p>
<h1><%= resource.getPath() %></h1>
<%
  for (var prop in resource.node) {
    %>
      <p>
        <%= resource.node[prop] %>
      </p>
    <%
  }
%>
</body>
</html>


---

Re: esp script not parsing

Posted by Peter Svensson <ps...@gmail.com>.
I just read in the 'use of javascript in usling' default page that " If you
created content with the µsling test content creation form.."  But I didn't
do tha, so maybe that is the issue.

I have mounted Sling as a webDAV file system under linux. Then I've copied
my existing Bunkai javascript/html files right in there. Now I try to add
some server-side scripting as well. Perhaps there are maic that needs to be
puored over the copied resources to make server side scripting work?

Cheers,
PS

On Jan 19, 2008 11:20 AM, Peter Svensson <ps...@gmail.com> wrote:

> Hmm. I don't really understand what I'm doing.
>
> Whatever url I access I get this;
>
> ** Node dumped by PlainTextRendererServlet**
> Node path:/bunkai
> Resource metadata: {sling.resolutionPath=/bunkai
> }
>
> ** Node properties **
> jcr:created: 2008-01-18T02:47:25.953Z
> jcr:primaryType: nt:folder
>
> Which I thought meant that my script ran, but when I look more closely, I see that this is autogenerated stuff.
> I've tried http://localhost:8080/bunkai, http://localhost:8080/bunkai.foo, et.c. and the same things show up.
>
> I've tried to copy the file as html.esp, foo.esp, both in the /bunkai folder and to the root ndoe, to no effect.
>
> What am I missing here?
>
> Does anyone have a working example, with placement rules, etc. that I can use??
> Cheers,
> PS
>
>
>
> I had planned on putting the script in the root source node, though, and
> then iterate from that
>
>
> On Jan 19, 2008 11:02 AM, Tobias Bocanegra < tobias.bocanegra@day.com>
> wrote:
>
> > you need to name it html.esp, or access the content with test.foo :-)
> > regards, toby
> >
> > On 1/19/08, Peter Svensson <ps...@gmail.com> wrote:
> > > HI again,
> > >
> > > now I've copied one of the esp examples info a file (called ' foo.esp'),
> > and
> > > when I access it in my usling installation, I just get the text of the
> > file.
> > > Is there something else that needs to be done, to enable esp parsing
> > on the
> > > server?
> > >
> > > ---
> > >
> > > <%-- ESP template example, store this as html.esp --%>
> > > <html>
> > > <body>
> > > <p>This page is generated from an ESP template!</p>
> > > <h1><%= resource.getPath () %></h1>
> > > <%
> > >   for (var prop in resource.node) {
> > >     %>
> > >       <p>
> > >         <%= resource.node[prop] %>
> > >       </p>
> > >     <%
> > >   }
> > > %>
> > > </body>
> > > </html>
> > >
> > >
> > > ---
> > >
> >
> >
> > --
> > -----------------------------------------< tobias.bocanegra@day.com >---
> > Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
> > T +41 61 226 98 98, F +41 61 226 98 97
> > -----------------------------------------------< http://www.day.com >---
> >
>
>

Re: esp script not parsing

Posted by Peter Svensson <ps...@gmail.com>.
Hm. I don't have a 'sling' directory anywhere, either in the real fs or in
Sling.
I created a directory called usling and zipped up the provided archive in
it.
That got me etc, lib, logs and webapps, and of course a lot of root-level
files (start.jar) et.c.

Where should I look for it?

Cheers,
PS

On Jan 19, 2008 5:27 PM, Bertrand Delacretaz <bd...@apache.org> wrote:

> On Jan 19, 2008 4:32 PM, Peter Svensson <ps...@gmail.com> wrote:
> > ...Hmm. This is really strange. I got it working a couple of times, and
> then
> > when I tried to change a couple of things I get (repeatedly);
> >
> > Failure running script /apps/nt/folder/json.esp: null...
> >
> > RequestURI=/bunkai.json
>
> Looks like a NullPointerException occuring somewhere in code called by
> your json.esp script.
>
> Hard to say what that might be...I'd try zapping the repository
> (remove the "sling" directory that was created when you first started
> microsling) and re-add the data step by step. But save that sling
> directory first, so that we can reproduce the problem and fix it.
>
> If that doesn't help, send us a zip of your sling directory (not here,
> attachments don't work, upload it somewhere) and I'll have a look at
> what's going on (not before Monday though).
>
> -Bertrand
>

Re: esp script not parsing

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Jan 19, 2008 4:32 PM, Peter Svensson <ps...@gmail.com> wrote:
> ...Hmm. This is really strange. I got it working a couple of times, and then
> when I tried to change a couple of things I get (repeatedly);
>
> Failure running script /apps/nt/folder/json.esp: null...
>
> RequestURI=/bunkai.json

Looks like a NullPointerException occuring somewhere in code called by
your json.esp script.

Hard to say what that might be...I'd try zapping the repository
(remove the "sling" directory that was created when you first started
microsling) and re-add the data step by step. But save that sling
directory first, so that we can reproduce the problem and fix it.

If that doesn't help, send us a zip of your sling directory (not here,
attachments don't work, upload it somewhere) and I'll have a look at
what's going on (not before Monday though).

-Bertrand

Re: esp script not parsing

Posted by Peter Svensson <ps...@gmail.com>.
Here is better info from the console, which might help better;


19.01.2008 21:56:40 *INFO * MicroslingResourceResolver: Path '/bunkai.foo'
does not resolve to an Item (MicroslingResourceResolver.java, line 363)
19.01.2008 21:56:40 *INFO * MicroslingResourceResolver: Found Resource
JcrNodeResource, type=nt:folder, path=/bunkai (
MicroslingResourceResolver.java, line 359)
19.01.2008 21:56:40 *INFO * MicroslingScriptResolver: Found nt:file script
node /apps/nt/folder/foo.esp for Resource=JcrNodeResource, type=nt:folder,
path=/bunkai (MicroslingScriptResolver.java, line 188)
2008-01-19 21:56:40.959::WARN:  Nested in
org.apache.sling.api.SlingException: Cannot get MicroslingScript: Failure
running script /apps/nt/folder/foo.esp: null:
javax.script.ScriptException: Failure running script
/apps/nt/folder/foo.esp: null


I tried to rename the file from json.esp to foo.esp, but no luck :)

Cheers,
PS

On Jan 19, 2008 4:32 PM, Peter Svensson <ps...@gmail.com> wrote:

> Hmm. This is really strange. I got it working a couple of times, and then
> when I tried to change a couple of things I get (repeatedly);
>
> HTTP ERROR: 500
>
> Failure running script /apps/nt/folder/json.esp: null
>
> RequestURI=/bunkai.json
> Caused by:
>
> javax.script.ScriptException: Failure running script /apps/nt/folder/json.esp: null
> 	at org.apache.sling.scripting.javascript.RhinoJavaScriptEngine.eval(RhinoJavaScriptEngine.java
> :93)
> 	at org.apache.sling.microsling.scripting.MicroslingScriptResolver$MicroslingScript.eval(MicroslingScriptResolver.java:278)
> 	at org.apache.sling.microsling.scripting.MicroslingScriptServlet.service(MicroslingScriptServlet.java
> :46)
> 	at org.apache.sling.microsling.servlet.MicroslingMainServlet.doService(MicroslingMainServlet.java:229)
> 	at org.apache.sling.microsling.servlet.MicroSlingFilterHelper$MicroSlingFilterChain.doFilter(MicroSlingFilterHelper.java
> :154)
> 	at org.apache.sling.microsling.contenttype.ResponseContentTypeResolverFilter.doFilter(ResponseContentTypeResolverFilter.java:51)
> 	at org.apache.sling.microsling.request.helpers.AbstractFilter.doFilter(AbstractFilter.java
> :92)
> 	at org.apache.sling.microsling.servlet.MicroSlingFilterHelper$MicroSlingFilterChain.doFilter(MicroSlingFilterHelper.java:149)
> 	at org.apache.sling.microsling.servlet.MicroSlingFilterHelper.service(MicroSlingFilterHelper.java
> :81)
> 	at org.apache.sling.microsling.servlet.MicroslingMainServlet.service(MicroslingMainServlet.java:183)
> 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
> 	at org.mortbay.jetty.servlet.ServletHandler.handle
> (ServletHandler.java:367)
> 	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
> 	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> 	at org.mortbay.jetty.handler.ContextHandler.handle
> (ContextHandler.java:712)
> 	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
> 	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
> 	at org.mortbay.jetty.handler.HandlerCollection.handle
> (HandlerCollection.java:114)
> 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
> 	at org.mortbay.jetty.Server.handle(Server.java:285)
> 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java
> :502)
> 	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:821)
> 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)
> 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java
> :208)
> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:378)
> 	at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:226)
>
> And I copy over the webDAV mounted file liek this (on a directory I created myself);
>
>  cp projects/usling/json.esp /mnt/apps/nt/folder/
>
> What is strange is that it did work, and now I have reverted to what I copied the first time, th "use of javascript in usling" page
>
> <%-- ESP template example, store this as html.esp --%>
> <html>
> <body>
> <p>This page is generated from an ESP template!</p>
> <h1><%= resource.getPath() %></h1>
> <%
>   for (var prop in resource.node) {
>
>     %>
>       <p>
>         <%= resource.node[prop] %>
>       </p>
>     <%
>   }
> %>
> </body>
>
>
> Thanks for any info,
>
> PS
> </html>
> 	at org.mortbay.thread.BoundedThreadPool$PoolThread.run
> (BoundedThreadPool.java:442)
>
>
>
> On Jan 19, 2008 4:14 PM, Peter Svensson <ps...@gmail.com> wrote:
>
> > I understand. But what I mean is that I know so little about Sling so I
> > can't even be trusted with what chapters to have in a documentation of it.
> > What I would like to be provided with is something like this;
> >
> > 1. Quick start to develop with Sling
> > 1.a Installation
> > 1.b Check that things work
> > 1.c Mount as webDAV (in windows and Linux)
> > 1.d Most important facts about Sling resources. Where the monsters are
> > and how to defy them.
> >
> > 2. Examples on how to access Sling resources from client
> > 2.a From Ajax-clients in browser
> > 2.b From Java programs
> >
> > 3. Examples on how to write Sling server-side scripts
> > 3.a What kind of resources can be used in scripts
> > 3.b Simple example in Rhino
> > 3.c Simple example in Erb
> > 3.d Simple example in Jsp
> >
> > 4.  etc...
> >
> >
> > And then I can fill in the actual content by asking around adn
> > experiment, but I would need someone to help me with the general outline.
> >
> > Cheers,
> > PS
> >
> >
> > On Jan 19, 2008 3:59 PM, Felix Meschberger <fm...@gmail.com> wrote:
> >
> > > Hi Peter,
> > >
> > > Am Samstag, den 19.01.2008, 15:36 +0100 schrieb Peter Svensson:
> > > > YES!  It worked. Thanks so much for saturday support :)
> > > > Actually you do have a lot of documentation, but only for internal
> > > > development, not for devlopers using Sling.
> > >
> > > Yes. And especially the docs on the site is outdated and does not
> > > reflect the current Sling API....
> > >
> > > >  I can write that, but I have to
> > > > learn it first.
> > >
> > > Now, this is good news !
> > >
> > > > If someone gave me a chapter index, with sub-subjects, I could fill
> > > them in
> > > > by pestering people on  this list, and it could be published as user
> > >
> > > > (developer of) dox.
> > >
> > > There is nothing like that. My current approach is to take, what is
> > > there and try to adapt to the current Sling API. This documentation
> > > stuff is in flux right now, and I tend to create docs upon user
> > > problems.
> > >
> > > Regards
> > > Felix
> > >
> > > >
> > > > Cheers,
> > > > PS
> > > >
> > > > On Jan 19, 2008 3:10 PM, Felix Meschberger <fmeschbe@gmail.com >
> > > wrote:
> > > >
> > > > > Hi Peter,
> > > > >
> > > > > Am Samstag, den 19.01.2008, 14:15 +0100 schrieb Peter Svensson:
> > > > > > OK, Good that I've still _some_ intuition working :)  But now I
> > > wonder
> > > > > where
> > > > > > the path  "/apps/nt/folder/"  can be found?  Is it somwhere in
> > > the
> > > > > "real"
> > > > > > filestructure of Sling, or is it within SLings own resource
> > > hierarchy?
> > > > >  I
> > > > > > can't seem to find it.
> > > > >
> > > > > The resource hierarchy of Sling is primarily based on the
> > > repository
> > > > > content. So if you are looking for an /apps/nt/folder location,
> > > you
> > > > > would look in the repository. If such a path does not exist, you
> > > may
> > > > > create it yourself - e.g. in WebDAV by just creating the
> > > respective
> > > > > directories.
> > > > >
> > > > > >
> > > > > > I can't find /sling/script either. Should I create those
> > > directores, and
> > > > > if
> > > > > > so, where? In my file system or inside SLing?
> > > > >
> > > > > You would create through WebDAV in the JCR Repository.
> > > > >
> > > > > >
> > > > > > Sorry for all the confusion.
> > > > >
> > > > > No problem. We are very gratefull to everyone taking the path of
> > > > > exploring Sling. It also shows us our documentation issues ....
> > > > >
> > > > > Regards
> > > > > Felix
> > > > >
> > > > >
> > > > > >
> > > > > > Cheers,
> > > > > > PS
> > > > > >
> > > > > > On Jan 19, 2008 12:42 PM, Bertrand Delacretaz <
> > > bdelacretaz@apache.org>
> > > > > > wrote:
> > > > > >
> > > > > > > On Jan 19, 2008 12:39 PM, Bertrand Delacretaz <bdelacretaz@apache.org
> > > >
> > > > > > > wrote:
> > > > > > >
> > > > > > > > ...2. transform that to a valid repository subpath, so for
> > > example
> > > > > > > > nt:folder becomes nt:folder...
> > > > > > >
> > > > > > > ...becomes nt/folder, of course.
> > > > > > >
> > > > > > > -Bertrand
> > > > > > >
> > > > >
> > > > >
> > >
> > >
> >
>

Re: esp script not parsing

Posted by Peter Svensson <ps...@gmail.com>.
Hmm. This is really strange. I got it working a couple of times, and then
when I tried to change a couple of things I get (repeatedly);

HTTP ERROR: 500

Failure running script /apps/nt/folder/json.esp: null

RequestURI=/bunkai.json
Caused by:

javax.script.ScriptException: Failure running script
/apps/nt/folder/json.esp: null
	at org.apache.sling.scripting.javascript.RhinoJavaScriptEngine.eval(RhinoJavaScriptEngine.java:93)
	at org.apache.sling.microsling.scripting.MicroslingScriptResolver$MicroslingScript.eval(MicroslingScriptResolver.java:278)
	at org.apache.sling.microsling.scripting.MicroslingScriptServlet.service(MicroslingScriptServlet.java:46)
	at org.apache.sling.microsling.servlet.MicroslingMainServlet.doService(MicroslingMainServlet.java:229)
	at org.apache.sling.microsling.servlet.MicroSlingFilterHelper$MicroSlingFilterChain.doFilter(MicroSlingFilterHelper.java:154)
	at org.apache.sling.microsling.contenttype.ResponseContentTypeResolverFilter.doFilter(ResponseContentTypeResolverFilter.java:51)
	at org.apache.sling.microsling.request.helpers.AbstractFilter.doFilter(AbstractFilter.java:92)
	at org.apache.sling.microsling.servlet.MicroSlingFilterHelper$MicroSlingFilterChain.doFilter(MicroSlingFilterHelper.java:149)
	at org.apache.sling.microsling.servlet.MicroSlingFilterHelper.service(MicroSlingFilterHelper.java:81)
	at org.apache.sling.microsling.servlet.MicroslingMainServlet.service(MicroslingMainServlet.java:183)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:367)
	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
	at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
	at org.mortbay.jetty.Server.handle(Server.java:285)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:502)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:821)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:208)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:378)
	at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:226)

And I copy over the webDAV mounted file liek this (on a directory I
created myself);

 cp projects/usling/json.esp /mnt/apps/nt/folder/

What is strange is that it did work, and now I have reverted to what I
copied the first time, th "use of javascript in usling" page

<%-- ESP template example, store this as html.esp --%>
<html>
<body>
<p>This page is generated from an ESP template!</p>
<h1><%= resource.getPath() %></h1>
<%
  for (var prop in resource.node) {
    %>
      <p>
        <%= resource.node[prop] %>
      </p>
    <%
  }
%>
</body>


Thanks for any info,

PS
</html>
	at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)



On Jan 19, 2008 4:14 PM, Peter Svensson <ps...@gmail.com> wrote:

> I understand. But what I mean is that I know so little about Sling so I
> can't even be trusted with what chapters to have in a documentation of it.
> What I would like to be provided with is something like this;
>
> 1. Quick start to develop with Sling
> 1.a Installation
> 1.b Check that things work
> 1.c Mount as webDAV (in windows and Linux)
> 1.d Most important facts about Sling resources. Where the monsters are and
> how to defy them.
>
> 2. Examples on how to access Sling resources from client
> 2.a From Ajax-clients in browser
> 2.b From Java programs
>
> 3. Examples on how to write Sling server-side scripts
> 3.a What kind of resources can be used in scripts
> 3.b Simple example in Rhino
> 3.c Simple example in Erb
> 3.d Simple example in Jsp
>
> 4.  etc...
>
>
> And then I can fill in the actual content by asking around adn experiment,
> but I would need someone to help me with the general outline.
>
> Cheers,
> PS
>
>
> On Jan 19, 2008 3:59 PM, Felix Meschberger <fm...@gmail.com> wrote:
>
> > Hi Peter,
> >
> > Am Samstag, den 19.01.2008, 15:36 +0100 schrieb Peter Svensson:
> > > YES!  It worked. Thanks so much for saturday support :)
> > > Actually you do have a lot of documentation, but only for internal
> > > development, not for devlopers using Sling.
> >
> > Yes. And especially the docs on the site is outdated and does not
> > reflect the current Sling API....
> >
> > >  I can write that, but I have to
> > > learn it first.
> >
> > Now, this is good news !
> >
> > > If someone gave me a chapter index, with sub-subjects, I could fill
> > them in
> > > by pestering people on  this list, and it could be published as user
> > > (developer of) dox.
> >
> > There is nothing like that. My current approach is to take, what is
> > there and try to adapt to the current Sling API. This documentation
> > stuff is in flux right now, and I tend to create docs upon user
> > problems.
> >
> > Regards
> > Felix
> >
> > >
> > > Cheers,
> > > PS
> > >
> > > On Jan 19, 2008 3:10 PM, Felix Meschberger <fmeschbe@gmail.com >
> > wrote:
> > >
> > > > Hi Peter,
> > > >
> > > > Am Samstag, den 19.01.2008, 14:15 +0100 schrieb Peter Svensson:
> > > > > OK, Good that I've still _some_ intuition working :)  But now I
> > wonder
> > > > where
> > > > > the path  "/apps/nt/folder/"  can be found?  Is it somwhere in the
> > > > "real"
> > > > > filestructure of Sling, or is it within SLings own resource
> > hierarchy?
> > > >  I
> > > > > can't seem to find it.
> > > >
> > > > The resource hierarchy of Sling is primarily based on the repository
> > > > content. So if you are looking for an /apps/nt/folder location, you
> > > > would look in the repository. If such a path does not exist, you may
> > > > create it yourself - e.g. in WebDAV by just creating the respective
> > > > directories.
> > > >
> > > > >
> > > > > I can't find /sling/script either. Should I create those
> > directores, and
> > > > if
> > > > > so, where? In my file system or inside SLing?
> > > >
> > > > You would create through WebDAV in the JCR Repository.
> > > >
> > > > >
> > > > > Sorry for all the confusion.
> > > >
> > > > No problem. We are very gratefull to everyone taking the path of
> > > > exploring Sling. It also shows us our documentation issues ....
> > > >
> > > > Regards
> > > > Felix
> > > >
> > > >
> > > > >
> > > > > Cheers,
> > > > > PS
> > > > >
> > > > > On Jan 19, 2008 12:42 PM, Bertrand Delacretaz <
> > bdelacretaz@apache.org>
> > > > > wrote:
> > > > >
> > > > > > On Jan 19, 2008 12:39 PM, Bertrand Delacretaz <bdelacretaz@apache.org
> > >
> > > > > > wrote:
> > > > > >
> > > > > > > ...2. transform that to a valid repository subpath, so for
> > example
> > > > > > > nt:folder becomes nt:folder...
> > > > > >
> > > > > > ...becomes nt/folder, of course.
> > > > > >
> > > > > > -Bertrand
> > > > > >
> > > >
> > > >
> >
> >
>

Re: esp script not parsing

Posted by Peter Svensson <ps...@gmail.com>.
I understand. But what I mean is that I know so little about Sling so I
can't even be trusted with what chapters to have in a documentation of it.
What I would like to be provided with is something like this;

1. Quick start to develop with Sling
1.a Installation
1.b Check that things work
1.c Mount as webDAV (in windows and Linux)
1.d Most important facts about Sling resources. Where the monsters are and
how to defy them.

2. Examples on how to access Sling resources from client
2.a From Ajax-clients in browser
2.b From Java programs

3. Examples on how to write Sling server-side scripts
3.a What kind of resources can be used in scripts
3.b Simple example in Rhino
3.c Simple example in Erb
3.d Simple example in Jsp

4.  etc...


And then I can fill in the actual content by asking around adn experiment,
but I would need someone to help me with the general outline.

Cheers,
PS

On Jan 19, 2008 3:59 PM, Felix Meschberger <fm...@gmail.com> wrote:

> Hi Peter,
>
> Am Samstag, den 19.01.2008, 15:36 +0100 schrieb Peter Svensson:
> > YES!  It worked. Thanks so much for saturday support :)
> > Actually you do have a lot of documentation, but only for internal
> > development, not for devlopers using Sling.
>
> Yes. And especially the docs on the site is outdated and does not
> reflect the current Sling API....
>
> >  I can write that, but I have to
> > learn it first.
>
> Now, this is good news !
>
> > If someone gave me a chapter index, with sub-subjects, I could fill them
> in
> > by pestering people on  this list, and it could be published as user
> > (developer of) dox.
>
> There is nothing like that. My current approach is to take, what is
> there and try to adapt to the current Sling API. This documentation
> stuff is in flux right now, and I tend to create docs upon user
> problems.
>
> Regards
> Felix
>
> >
> > Cheers,
> > PS
> >
> > On Jan 19, 2008 3:10 PM, Felix Meschberger <fm...@gmail.com> wrote:
> >
> > > Hi Peter,
> > >
> > > Am Samstag, den 19.01.2008, 14:15 +0100 schrieb Peter Svensson:
> > > > OK, Good that I've still _some_ intuition working :)  But now I
> wonder
> > > where
> > > > the path  "/apps/nt/folder/"  can be found?  Is it somwhere in the
> > > "real"
> > > > filestructure of Sling, or is it within SLings own resource
> hierarchy?
> > >  I
> > > > can't seem to find it.
> > >
> > > The resource hierarchy of Sling is primarily based on the repository
> > > content. So if you are looking for an /apps/nt/folder location, you
> > > would look in the repository. If such a path does not exist, you may
> > > create it yourself - e.g. in WebDAV by just creating the respective
> > > directories.
> > >
> > > >
> > > > I can't find /sling/script either. Should I create those directores,
> and
> > > if
> > > > so, where? In my file system or inside SLing?
> > >
> > > You would create through WebDAV in the JCR Repository.
> > >
> > > >
> > > > Sorry for all the confusion.
> > >
> > > No problem. We are very gratefull to everyone taking the path of
> > > exploring Sling. It also shows us our documentation issues ....
> > >
> > > Regards
> > > Felix
> > >
> > >
> > > >
> > > > Cheers,
> > > > PS
> > > >
> > > > On Jan 19, 2008 12:42 PM, Bertrand Delacretaz <
> bdelacretaz@apache.org>
> > > > wrote:
> > > >
> > > > > On Jan 19, 2008 12:39 PM, Bertrand Delacretaz <
> bdelacretaz@apache.org>
> > > > > wrote:
> > > > >
> > > > > > ...2. transform that to a valid repository subpath, so for
> example
> > > > > > nt:folder becomes nt:folder...
> > > > >
> > > > > ...becomes nt/folder, of course.
> > > > >
> > > > > -Bertrand
> > > > >
> > >
> > >
>
>

Re: esp script not parsing

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

Am Samstag, den 19.01.2008, 15:36 +0100 schrieb Peter Svensson:
> YES!  It worked. Thanks so much for saturday support :)
> Actually you do have a lot of documentation, but only for internal
> development, not for devlopers using Sling.

Yes. And especially the docs on the site is outdated and does not
reflect the current Sling API....

>  I can write that, but I have to
> learn it first.

Now, this is good news !

> If someone gave me a chapter index, with sub-subjects, I could fill them in
> by pestering people on  this list, and it could be published as user
> (developer of) dox.

There is nothing like that. My current approach is to take, what is
there and try to adapt to the current Sling API. This documentation
stuff is in flux right now, and I tend to create docs upon user
problems.

Regards
Felix

> 
> Cheers,
> PS
> 
> On Jan 19, 2008 3:10 PM, Felix Meschberger <fm...@gmail.com> wrote:
> 
> > Hi Peter,
> >
> > Am Samstag, den 19.01.2008, 14:15 +0100 schrieb Peter Svensson:
> > > OK, Good that I've still _some_ intuition working :)  But now I wonder
> > where
> > > the path  "/apps/nt/folder/"  can be found?  Is it somwhere in the
> > "real"
> > > filestructure of Sling, or is it within SLings own resource hierarchy?
> >  I
> > > can't seem to find it.
> >
> > The resource hierarchy of Sling is primarily based on the repository
> > content. So if you are looking for an /apps/nt/folder location, you
> > would look in the repository. If such a path does not exist, you may
> > create it yourself - e.g. in WebDAV by just creating the respective
> > directories.
> >
> > >
> > > I can't find /sling/script either. Should I create those directores, and
> > if
> > > so, where? In my file system or inside SLing?
> >
> > You would create through WebDAV in the JCR Repository.
> >
> > >
> > > Sorry for all the confusion.
> >
> > No problem. We are very gratefull to everyone taking the path of
> > exploring Sling. It also shows us our documentation issues ....
> >
> > Regards
> > Felix
> >
> >
> > >
> > > Cheers,
> > > PS
> > >
> > > On Jan 19, 2008 12:42 PM, Bertrand Delacretaz <bd...@apache.org>
> > > wrote:
> > >
> > > > On Jan 19, 2008 12:39 PM, Bertrand Delacretaz <bd...@apache.org>
> > > > wrote:
> > > >
> > > > > ...2. transform that to a valid repository subpath, so for example
> > > > > nt:folder becomes nt:folder...
> > > >
> > > > ...becomes nt/folder, of course.
> > > >
> > > > -Bertrand
> > > >
> >
> >


Re: esp script not parsing

Posted by Peter Svensson <ps...@gmail.com>.
YES!  It worked. Thanks so much for saturday support :)
Actually you do have a lot of documentation, but only for internal
development, not for devlopers using Sling. I can write that, but I have to
learn it first.
If someone gave me a chapter index, with sub-subjects, I could fill them in
by pestering people on  this list, and it could be published as user
(developer of) dox.

Cheers,
PS

On Jan 19, 2008 3:10 PM, Felix Meschberger <fm...@gmail.com> wrote:

> Hi Peter,
>
> Am Samstag, den 19.01.2008, 14:15 +0100 schrieb Peter Svensson:
> > OK, Good that I've still _some_ intuition working :)  But now I wonder
> where
> > the path  "/apps/nt/folder/"  can be found?  Is it somwhere in the
> "real"
> > filestructure of Sling, or is it within SLings own resource hierarchy?
>  I
> > can't seem to find it.
>
> The resource hierarchy of Sling is primarily based on the repository
> content. So if you are looking for an /apps/nt/folder location, you
> would look in the repository. If such a path does not exist, you may
> create it yourself - e.g. in WebDAV by just creating the respective
> directories.
>
> >
> > I can't find /sling/script either. Should I create those directores, and
> if
> > so, where? In my file system or inside SLing?
>
> You would create through WebDAV in the JCR Repository.
>
> >
> > Sorry for all the confusion.
>
> No problem. We are very gratefull to everyone taking the path of
> exploring Sling. It also shows us our documentation issues ....
>
> Regards
> Felix
>
>
> >
> > Cheers,
> > PS
> >
> > On Jan 19, 2008 12:42 PM, Bertrand Delacretaz <bd...@apache.org>
> > wrote:
> >
> > > On Jan 19, 2008 12:39 PM, Bertrand Delacretaz <bd...@apache.org>
> > > wrote:
> > >
> > > > ...2. transform that to a valid repository subpath, so for example
> > > > nt:folder becomes nt:folder...
> > >
> > > ...becomes nt/folder, of course.
> > >
> > > -Bertrand
> > >
>
>

Re: esp script not parsing

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

Am Samstag, den 19.01.2008, 14:15 +0100 schrieb Peter Svensson:
> OK, Good that I've still _some_ intuition working :)  But now I wonder where
> the path  "/apps/nt/folder/"  can be found?  Is it somwhere in the "real"
> filestructure of Sling, or is it within SLings own resource hierarchy?  I
> can't seem to find it.

The resource hierarchy of Sling is primarily based on the repository
content. So if you are looking for an /apps/nt/folder location, you
would look in the repository. If such a path does not exist, you may
create it yourself - e.g. in WebDAV by just creating the respective
directories.

> 
> I can't find /sling/script either. Should I create those directores, and if
> so, where? In my file system or inside SLing?

You would create through WebDAV in the JCR Repository.

> 
> Sorry for all the confusion.

No problem. We are very gratefull to everyone taking the path of
exploring Sling. It also shows us our documentation issues ....

Regards
Felix


> 
> Cheers,
> PS
> 
> On Jan 19, 2008 12:42 PM, Bertrand Delacretaz <bd...@apache.org>
> wrote:
> 
> > On Jan 19, 2008 12:39 PM, Bertrand Delacretaz <bd...@apache.org>
> > wrote:
> >
> > > ...2. transform that to a valid repository subpath, so for example
> > > nt:folder becomes nt:folder...
> >
> > ...becomes nt/folder, of course.
> >
> > -Bertrand
> >


Re: esp script not parsing

Posted by Peter Svensson <ps...@gmail.com>.
OK, Good that I've still _some_ intuition working :)  But now I wonder where
the path  "/apps/nt/folder/"  can be found?  Is it somwhere in the "real"
filestructure of Sling, or is it within SLings own resource hierarchy?  I
can't seem to find it.

I can't find /sling/script either. Should I create those directores, and if
so, where? In my file system or inside SLing?

Sorry for all the confusion.

Cheers,
PS

On Jan 19, 2008 12:42 PM, Bertrand Delacretaz <bd...@apache.org>
wrote:

> On Jan 19, 2008 12:39 PM, Bertrand Delacretaz <bd...@apache.org>
> wrote:
>
> > ...2. transform that to a valid repository subpath, so for example
> > nt:folder becomes nt:folder...
>
> ...becomes nt/folder, of course.
>
> -Bertrand
>

Re: esp script not parsing

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Jan 19, 2008 12:39 PM, Bertrand Delacretaz <bd...@apache.org> wrote:

> ...2. transform that to a valid repository subpath, so for example
> nt:folder becomes nt:folder...

...becomes nt/folder, of course.

-Bertrand

Re: esp script not parsing

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Jan 19, 2008 11:20 AM, Peter Svensson <ps...@gmail.com> wrote:

> ...Whatever url I access I get this;
>
> ** Node dumped by PlainTextRendererServlet**...

This means that microsling-core didn't find a specific script to
process the Resource.

> ...** Node properties **
> jcr:created: 2008-01-18T02:47:25.953Z
> jcr:primaryType: nt:folder...

Your node doesn't have a sling:resourceType property, so
microsling-core will look for scripts based on the node type.

If vou have created the /bunkai node via WebDAV, its node type is most
probably nt:folder (or maybe nt:file), as opposed to nt:unstructured
if you had created it using the content-creation test form (but in the
latter case you can set the sling:resourceType so the node type
wouldn't matter for script resolution).

The script resolution rules in microsling-core are as follows (and
we're missing good log messages ATM to follow them live - a java
debugger would help if you're used to that):

1. use the sling:resourceType property of the node, or the node type
if that property is not set

2. transform that to a valid repository subpath, so for example
nt:folder becomes nt:folder

3. look for scripts under a series of search paths:

  /sling/scripts
  /apps

So in your case, if /bunkai is an nt:folder node with no
sling:resourceType property, putting your script under
/apps/nt/folder/json.js (or nt/file if it's an nt:file node), and
requesting http://localhost:8080/bunkai.json should work.

The script resolution happens in the MicroslingScriptResolver class,
if you want to have a closer look.

Hope this helps - we need to improve logging in this area to allow
people to follow what's happening, and document how to connect to the
repository with a browsing utility to see node details.

-Bertrand

Re: esp script not parsing

Posted by Peter Svensson <ps...@gmail.com>.
Hmm. I don't really understand what I'm doing.

Whatever url I access I get this;

** Node dumped by PlainTextRendererServlet**
Node path:/bunkai
Resource metadata: {sling.resolutionPath=/bunkai}

** Node properties **
jcr:created: 2008-01-18T02:47:25.953Z
jcr:primaryType: nt:folder

Which I thought meant that my script ran, but when I look more
closely, I see that this is autogenerated stuff.
I've tried http://localhost:8080/bunkai,
http://localhost:8080/bunkai.foo, et.c. and the same things show up.

I've tried to copy the file as html.esp, foo.esp, both in the /bunkai
folder and to the root ndoe, to no effect.

What am I missing here?

Does anyone have a working example, with placement rules, etc. that I can use??
Cheers,
PS



I had planned on putting the script in the root source node, though, and
then iterate from that

On Jan 19, 2008 11:02 AM, Tobias Bocanegra <to...@day.com> wrote:

> you need to name it html.esp, or access the content with test.foo :-)
> regards, toby
>
> On 1/19/08, Peter Svensson <ps...@gmail.com> wrote:
> > HI again,
> >
> > now I've copied one of the esp examples info a file (called 'foo.esp'),
> and
> > when I access it in my usling installation, I just get the text of the
> file.
> > Is there something else that needs to be done, to enable esp parsing on
> the
> > server?
> >
> > ---
> >
> > <%-- ESP template example, store this as html.esp --%>
> > <html>
> > <body>
> > <p>This page is generated from an ESP template!</p>
> > <h1><%= resource.getPath() %></h1>
> > <%
> >   for (var prop in resource.node) {
> >     %>
> >       <p>
> >         <%= resource.node[prop] %>
> >       </p>
> >     <%
> >   }
> > %>
> > </body>
> > </html>
> >
> >
> > ---
> >
>
>
> --
> -----------------------------------------< tobias.bocanegra@day.com >---
> Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
> T +41 61 226 98 98, F +41 61 226 98 97
> -----------------------------------------------< http://www.day.com >---
>

Re: esp script not parsing

Posted by Tobias Bocanegra <to...@day.com>.
you need to name it html.esp, or access the content with test.foo :-)
regards, toby

On 1/19/08, Peter Svensson <ps...@gmail.com> wrote:
> HI again,
>
> now I've copied one of the esp examples info a file (called 'foo.esp'), and
> when I access it in my usling installation, I just get the text of the file.
> Is there something else that needs to be done, to enable esp parsing on the
> server?
>
> ---
>
> <%-- ESP template example, store this as html.esp --%>
> <html>
> <body>
> <p>This page is generated from an ESP template!</p>
> <h1><%= resource.getPath() %></h1>
> <%
>   for (var prop in resource.node) {
>     %>
>       <p>
>         <%= resource.node[prop] %>
>       </p>
>     <%
>   }
> %>
> </body>
> </html>
>
>
> ---
>


-- 
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---