Latest Posts

Archives [+]

Categories [+]

Authors [+]

Sling Cheat Sheet

My approach to learning a new technology (or-relearning something that changed several times since I last spend time with it) is writing documentation. As I wanted to write a small Sling application using the newly released Apache Sling 1.0, I decided to create a one-page documentation of the Script-resolution process in Sling. This is the frontside of my cheat sheet. It shows you how to get from HTTP request to content node, from content node to resource type, from resource type to script and what scripting variables are available.

On the flipside of the cheat sheet I documented all the hidden, but powerful request parameters you can use when dealing with the SlingPostServlet, the default handler for all POST requests that gives you endless options for creating, modifying, deleting, copying and moving nodes in your repository.

Click on the thumbnails to get a high-resolution PDF version of either side (3,7 and 1,7 MB) or download the PDF version (300 KB) here.

 
(optional)
8 comments
Hi Lars,

Thanks for this ! Great thing. Just two things to note: (1) The resource type resolution does not fall back to sling:resourceSuperType if there is not sling:resourceType property. Instead it first tries a pluggable mechanism (nothing there by default) and finally uses the primary node type. The resource super type is only used in the next step of script resolution if the resource type is already known. (2) The functionality of the Sling POST Servlet is not really hidden. All the parameters are documented at http://incubator.apache.org/sling/site/manipulating-content-the-slingpostservlet.html
0 Replies » Reply
please find a CRX aware version here:

http://www.day.com/o.file/scriptrespatch.001-002.png?get=a5325cc3dba758c43d269a8b909c9028
0 Replies » Reply
hi Lars,
Thanks for the cheatsheet, very helpful!
cheers, Renaud
0 Replies » Reply
Very nice cheat sheet Lars.

I do have a question though... How would this defend against an attack? If a user were to say change some of the names of the fields in form then submit, would that in turn change your model that you expect in your repository?

Please understand that I haven't had a great deal to time to look into Sling, but it looks very interesting and would like to learn more.

Respectfully,
John
0 Replies » Reply

Resource dumped by HtmlRendererServlet

Resource path: /content/usergenerated/content/ddc/blog/2008/07/cheatsheet/jcr:content/comments/Verynicech

Resource metadata: {sling.resolutionPath=/content/usergenerated/content/ddc/blog/2008/07/cheatsheet/jcr:content/comments/Verynicech}

Resource type: cq:Comment

Resource super type: -

Resource properties

jcr:createdBy: admin
jcr:created: java.util.GregorianCalendar[time=1263977020765,areFieldsSet=true,areAllFieldsSet=true,lenient=false,zone=sun.util.calendar.ZoneInfo[id="GMT-05:00",offset=-18000000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2010,MONTH=0,WEEK_OF_YEAR=4,WEEK_OF_MONTH=4,DAY_OF_MONTH=20,DAY_OF_YEAR=20,DAY_OF_WEEK=4,DAY_OF_WEEK_IN_MONTH=3,AM_PM=0,HOUR=3,HOUR_OF_DAY=3,MINUTE=43,SECOND=40,MILLISECOND=765,ZONE_OFFSET=-18000000,DST_OFFSET=0]
jcr:primaryType: cq:Comment

learned how http://www.mywowin.com/ to http://linksoflondoncharms.blog.friendster.com appreciate the music from http://www.soulcast.com/tochinatravel318/ there a little more. For example,
http://travellerspace.onsugar.com/ I have music by the Buena Vista Social Club, by Ibrahim Ferrer and Compay Secundo. I think the music they produced was stellar; it’s a shame that they lived so much time in anonymity. I also listen to Lecuona, one of the greatest composers from Cuba; I like his work tremendously.
0 Replies » Reply
Among other best kept secrets of Marrakesh is Riad La Terrasse des Olivier on the northern edge of the Medinahttp://www.topchinatrip.com/ Riads in Marrakech and another thousand or so unofficial ones, the exact number remaining a carefully guarded secret.http://www.arfblog001.com/ Riads in Marrakech and another thousand or so unofficial ones, the exact number remaining a carefully guarded secret.http://www.myowpower.com/ Riads in Marrakech and another thousand or so unofficial ones, the exact number remaining a carefully guarded secret.http://www.lvlkk.com/ Riads in Marrakech and another thousand or so unofficial ones, the exact number remaining a carefully guarded secret.China Trip Riads in Marrakech and another thousand or so unofficial ones, the exact number remaining a carefully guarded secret.
0 Replies » Reply
Youssef – a shy and extremely polite young man who acts as both a security guard and a waiter and is always happy to accompany you to the Medinahttp://www.kpkgold.com/ Youssef – a shy and extremely polite young man who acts as both a security guard and a waiter and is always happy to accompany you to the Medinahttp://www.slkgood.com/ Youssef – a shy and extremely polite young man who acts as both a security guard and a waiter and is always happy to accompany you to the Medinahttp://www.slolgold.com/ Youssef – a shy and extremely polite young man who acts as both a security guard and a waiter and is always happy to accompany you to the Medinahttp://www.uswows.com/ Youssef – a shy and extremely polite young man who acts as both a security guard and a waiter and is always happy to accompany you to the Medina
0 Replies » Reply