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/22 21:09:08 UTC

Some esp debuging..

I have hit quiet a lot of brick walls today, mostly due to my quick reading
:)
But I've noticed one odd thing: When I remove the initial <%-- ... -%>  from
an esp script, Sling bombs like this;

23.01.2008 02:24:23 *INFO * MicroslingResourceResolver: Path '/content.html'
does not resolve to an Item (MicroslingResourceResolver.java, line 363)
23.01.2008 02:24:23 *INFO * MicroslingResourceResolver: Found Resource
JcrNodeResource, type=nt:unstructured, path=/content (
MicroslingResourceResolver.java, line 359)
23.01.2008 02:24:23 *INFO * MicroslingScriptResolver: Found nt:file script
node /sling/scripts/nt/unstructured/html.esp for Resource=JcrNodeResource,
type=nt:unstructured, path=/content (MicroslingScriptResolver.java, line
188)
2008-01-23 02:24:23.432::WARN:  Nested in
org.apache.sling.api.SlingException: Cannot get MicroslingScript: Failure
running script /sling/scripts/nt/unstructured/html.esp: null:
javax.script.ScriptException: Failure running script
/sling/scripts/nt/unstructured/html.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)


But if I add comments again, it works. or rather, the example script gives
an empty page, but still;

example script;

<%-- ESP directory listing example -%>
<html>
<body>
<p>This HTML directory listing is generated from an ESP template!</p>
<h1><%= resource.uri %></h1>
<ol>
<%
for (var prop in resource.node) {
    if (resource.node[prop]["text"]) {
        %><li><a href="/<%= resource.node[prop] %>.html"><%=
resource.node[prop] %></a></li><%
    }
}
%>
</ol>
</body>
</html>



Also, when Sling does not bomb, it gives back an empty page, no hmtl,
nothing. But the console says it found the script at least.

Another good idea would be to create an initial node structure for users
like me, for sling/scripts/nt/... et.c.  Maybe with the examples pasted in
(and tested :), so it's easier to grok what is magic and what can be
changed.

I'll experiment some more.

Cheers,
PS