Hi Bertrand

2010/6/17 Bertrand Delacretaz <[email protected]>

> Hi,
>
> On Thu, Jun 17, 2010 at 3:51 PM, Federico Paparoni
> <[email protected]> wrote:
> > ...If I use the url http://localhost:8080/content/david.list (calling it
> on the
> > root node :P) I receive the plain text...
>
> That's not calling it on the root node, root node would be
> http://localhost:8080/
>
>
I meant the root node of the app :)


> What happens here is that Sling selects the /content/david node as the
> current resource, looks at its sling:resourceType property (if there's
> one), and finds a script or servlet to render that resource type with
> the "list" extension.
>
> You should be able to follow that process using the "recent requests"
> plugin at /system/console, Sling should show there what the resource
> type is, and which script it selects to process the request.
>
> I'm not sure why this doesn't use your script at /apps/david/list.esp,
> what's the sling:resourceType of that node?
>
>
The node hasn't a sling:resourceType. I package it in the bundle so it has
been copied in the /app/david folder.
This is what I see in the recent requests:

  0 (2010-06-18 12:22:05) TIMER_START{Request Processing}
      0 (2010-06-18 12:22:05) COMMENT timer_end format is {<elapsed
msec>,<timer name>} <optional message>
      0 (2010-06-18 12:22:05) LOG Method=GET, PathInfo=/content/david.list
      0 (2010-06-18 12:22:05) TIMER_START{ResourceResolution}
      0 (2010-06-18 12:22:05) TIMER_END{0,ResourceResolution}
URI=/content/david.list resolves to Resource=JcrNodeResource,
type=david, superType=null, path=/content/david
      0 (2010-06-18 12:22:05) LOG Resource Path Info:
SlingRequestPathInfo: path='/content/david', selectorString='null',
extension='list', suffix='null'
      0 (2010-06-18 12:22:05) TIMER_START{ServletResolution}
      0 (2010-06-18 12:22:05)
TIMER_START{resolveServlet(JcrNodeResource, type=david,
superType=null, path=/content/david)}
      0 (2010-06-18 12:22:05)
TIMER_END{0,resolveServlet(JcrNodeResource, type=david,
superType=null, path=/content/david)} Using servlet
/apps/david/list.esp
      0 (2010-06-18 12:22:05) TIMER_END{0,ServletResolution}
URI=/content/david.list handled by Servlet=/apps/david/list.esp
      0 (2010-06-18 12:22:05) LOG Applying request filters
      0 (2010-06-18 12:22:05) LOG Calling filter:
org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter
      0 (2010-06-18 12:22:05) TIMER_START{/apps/david/list.esp#0}
    187 (2010-06-18 12:22:05) TIMER_END{187,/apps/david/list.esp#0}

187 (2010-06-18 12:22:05) TIMER_END{187,Request Processing} Request
Processing

and this is what I see in the log

18.06.2010 12:22:05.724 *INFO* [127.0.0.1 [1276856525724] GET
/content/david.list HTTP/1.1] logs/request.log 18/Jun/2010:12:22:05 +0200
[29] -> GET /content/david.list HTTP/1.1

18.06.2010 12:22:05.911 *INFO* [127.0.0.1 [1276856525724] GET
/content/david.list HTTP/1.1] logs/request.log 18/Jun/2010:12:22:05 +0200
[29] <- 200 text/plain 187ms


> That request selects the same node, but with a "list" selector and
> "html" extension. If your resource type is "david" that should use the
> script at /apps/david/html.esp, or /apps/david/list.esp if that
> exists. The latter takes precedence as it's more specific.
>
> Here's an example that works for me:
>
> # create content node
> curl -F sling:resourceType=david http://admin:ad...@localhost
> :8888/content/david
> curl http://admin:ad...@localhost:8888/content/david.tidy.json (to
> check content)
>
> # upload script to render it
> echo "Hello this is list.esp" > /tmp/list.esp
> # this fails if /apps exists, fine
> curl -X MKCOL http://admin:ad...@localhost:8888/apps
> curl -X MKCOL http://admin:ad...@localhost:8888/apps/david
> curl -T /tmp/list.esp http://admin:ad...@localhost
> :8888/apps/david/list.esp
>
> # render node
> # this  says "Hello this is list.esp"
> curl http://admin:ad...@localhost:8888/content/david.list
> # this also says "Hello this is list.esp"
> curl http://admin:ad...@localhost:8888/content/david.list.html
>
> # Now demonstrate html.esp vs. list.esp
> echo "Now this is html.esp" > /tmp/html.esp
> curl -T /tmp/html.esp http://admin:ad...@localhost
> :8888/apps/david/html.esp
> # This says "Now this is html.esp"
> curl http://admin:ad...@localhost:8888/content/david.html
> # This says "Hello this is list.esp"
> curl http://admin:ad...@localhost:8888/content/david.list.html
>
> You could try that (on a fresh repository maybe) and see what's
> different in your case.
>
>
Yes this example works but it doesn't work for the script I developed. I
don't make something different for this file, so I don't understand why it
doesn't work like other script.



-- 
Federico

Reply via email to