Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added scripts for star resources from mailing list discussion

...

See SLING-580, the SlingServletResolver class logs detailed information (at the DEBUG level) to indicate in which order the candidate scripts and servlets are considered for processing a request.

How do I render a script for a star "*" resource?

"*" resources do not have a sling:resourceType which can cause confusion when you're trying to render a specific script. Consider:

Suppose we have content such as:

No Format

content
--gradapp
----application
--------app1
--------app2
------------tabs
----------------tab1
----------------tab2

apps
--gradapp
----application
--------edit.esp
--------html.esp
--------list.esp
----tab
--------edit.esp

In this case, http://localhost:8888/gradapp/application/app1.edit.htmlImage Added will provide an edit page for the app1 resource using the script from apps/gradapp/application/edit.esp. However, http://localhost:8888/gradapp/application/*.edit.htmlImage Added will not use that edit.esp script.

By default the "star resource" does not have a resource type, so you get the default rendering. To give it a specific resource type based on its path, you can install and start the samples/path-based-rtp bundle.

Another suggestion is to register a generic node creation form script, e.g. at /apps/sling/servlet/default/create.esp. You should be able to invoke that script by browsing to /gradapp/application/*.create. If you want the create.esp script to be able to render different forms
(e.g. one for applications, one for tabs) you could do so by checking on a query parameter.

So requesting "/gradapp/application/.create?typeToCreate=application" could give a form for creating application nodes, while "/gradapp/application/.create?typeToCreate=tab" could give the tab form.

See: http://markmail.org/message/htl6r3uctuzb6l5qImage Added and http://mail-archives.apache.org/mod_mbox/sling-users/200911.mbox/%3c8A802DC6-7472-4040-807A-D55524F30D3E@gmail.com%3eImage Added

How to replace the default json renderer (for example) with my own?

...