2
sling:resourceSuperType= «null» 4 Script Locations 3 Get Resource Type GET /wiki/Sling.edit.html/richtext?simple=true HTTP/1.1 sling:resourceType= wiki/page /libs/wiki/page/ <% log.info("Executing my script"); if (request.getRequestParameter("simple")) { response.sendRedirect("http://localhost/"); } %> <html> <head><title><%=currentNode.title %></title></head> <body> <h1><%=resource.getPath() %></h1> <% out.println(reader.toString()); %> <% sling.include(resource.getPath() + "content", "replaceSelectors= edit"); %> </body> </html> 1 HTTP Request 2 Content Resolution /wiki/Sling Path Selector Extension Suffix Query Parameters Method jcr:primaryType= nt:file Node has properties fallback: use: last resort: Resource Type either: /apps/wiki/page/ or: 5 Script Names 6 Script 7 Include Options edit.html.esp edit.esp html.esp GET.esp Method Extension Selector Selector+Extension Best match: Worst match: sling.include("path", "forceResourceType= wiki/body, replaceSuffix= xhtml, addSelectors= foo.bar"); (Powerful) sling:resourceType wiki/page Property Sling Intro body Value title <div>Hello World</div> Apache Sling understanding script resolution

Sling Cheatsheet

Embed Size (px)

DESCRIPTION

Cheatsheet for the Apache Sling framework.

Citation preview

understanding

Apache SlingSele cto rEx te ns ion

script resolutionSu fx

1 2 3 4 5Best match:

Metho d

HTTP Request

GET /wiki/Sling.edit.html/richtext?simple=true HTTP/1.1Pat h Que ry Parame tersProperty title body Value Sling Intro Hello World

Content Resolution

/wiki/SlingNode has properties

sling:resourceType

wiki/page

Get Resource Type

us e: sling:resourceType= fa llb ac k: sling:resourceSuperType=wiki/page null

Resource Type

las t jcr:primaryType= re so rt: nt:file

Script Locations

eit he r:

/apps/wiki/page/

or: /libs/wiki/page/

Script NamesExtens ionedit.esp html.espWorst match:

6Script

edit.html.espSelecto r+Exten sion

GET.esp

Sele cto r

Met ho d

7

Include Optionssling.include("path", "forceResourceType= wiki/body, (Powerf ul) replaceSuffix= xhtml, addSelectors= foo.bar");

script");