14. Resource Resolution
How do I get what I want how I want it
http://sling.apache.org/site/dispatching-requests.html
http://sling.apache.org/site/url-decomposition.html
15. Method
Resource Path
Selectors
Extension
Suffix
POST /content/project/test.page.html/cool
28. Other fun OOTB Stuff
Authentication (form based, openid)
Scheduling (Quartz)
Version Control (JCR)
Other JVM Languages (EcmaScript,
Groovy, Scala.....)
33. Install a few bundles from extras
http://localhost:8080/system/console/bundles
1) Sling Engine 2.2.4 (Bug Fix)
2) JSTL libs
3) Groovy
34. Create a Base Script
1) HTML boilerplate
2) Styles (bootstrap)
3) Any JavaScript
4) Test Content
35. Create a WYSIWYG Page
1) Import ckeditor JavaScript libs
2) Add JavaScript Include to head.jsp
3) Create new Script for content page
4) Add sling include to base script
5) Add content node to Home Page
36. Create a Build a New Page...Page
1) Create new Script
2) Add content node
3) Add to menu
37. Build an Image Upload Page
1) Create image upload script
2) Add content node
3) Add to menu
38. Making it Groovy!
(or Scala or Ruby or whatever
you're willing to implement with
JSR 233)
43. Thank You.
Go forth and enjoy Sling
Email: bob@bobpaulin.com
Twitter: @bobpaulin
Linkedin: http://www.linkedin.com/in/bobpaulin
Blog: http://bobpaulin.com
Hinweis der Redaktion
Sell yourself I write code I do design/architecture I lead teams I make development teams better.
And that's a good thing because these are often things that we want to define.
I want to build a website that people can go to and enter content. Without training, intuitive
Lots of product options. Each has it's benefits Many can be stood up quickly out of the box. But what if I want to customize?
Wait you just said the C word Customizing a product can be death by 1000 cuts depending on what you're doing.
Frameworks offer a middle ground. They solve a problem but still grant you the flexibility to customize.
So lets talk about sling
Combination of open source projects to make content driven sites easier.
Kind of a chicken or egg thing here. David Neuschler of Day Software created the JSR for JCR. They build Day CQ. Then donated the Sling framework to Apache. A number of Day (now Adobe) employees still run the community for it.
Very different mind set than your typical Web App. Content not MVC runs the show.
So Sling is RESTful by design HTTP request to get data in and out GET - retrieve POST – Create/Modify
Run simple curl commands Note we're creating a multi value field Display the urls through curl
The most sophisticated part of the system. And the hardest to learn. But once you get it. Some incredibly hard problems become easy.
Resource Path – just like your typical web app. Where to retrieve information from. Selectors – Identifies specific content and acts as a parameter passer. Great for SEO. Extention – helps identify the script we're running. Suffix – a second path that is useful to identify additional content.
Note that the multi field is missing. A Bug? Maybe I should submit a jira :).
JCR is the persistence for sling. Underlying it is a file system or a Database. Can run on several Dbs. OOTB it's HSQL.
Eclipse provides a plugin to view and do some simple JCR modifications. One way to administer. Also could use WebDav to move files. Or maven or json/xml with sling.
Lets trace what a homepage request will look like in our soon to be live CMS.
Here is the structure Bot extend the JCR root Apps directory contains scripts: JSP, GSP, ESP.. could be more. Content directory contains content nodes.
Request comes into sling and resolves to a node. That node looks at it's type then tries to resolve a script
That type searches the apps directory (also could go to the libs directory) Once it gets to the folder it wants then it tries to resolve to a script using selectors and extentions. Script executes but wait theirs a sling include tag
Ok we're looking for a node content that's a child of the node we asked for. Child also then resolves it's type
Back to the script directory Selectors and extensions are once again used. If none are provided they are inherited from the parent. Page returns.