SlideShare a Scribd company logo
1 of 43
“Build your own CMS with Apache Sling”
             By Bob Paulin
          Paulin Solutions LLC
Independent
      Developer/Architect/Lead

            Focused on:
Web Centric Application Development
              Mobile
      Development Support
Stuff Sling doesn't give you
BYO...

Robust Login Security
XSS Protection
WYSIWYG Editors
The Problem:
I want to create a content driven website.
Lots of Options
STOP!

Do one of these meet all of my needs or are
      they just part of the solution?
Why not use a framework instead!

            SLING
What is Sling?
Best of Breed

Apache Felix (OSGi)
Apache Jackrabbit (JCR)
REST
Who's already using Sling?


       Adobe CQ 5
How does Sling Work?
Sling Post Servlet
         One stop shop for Content CRUD
http://sling.apache.org/site/manipulating-content-the-slingpostservlet-servletspost.html
Create/Modify
               curl -u admin:admin -Fmulti=one -Fmulti=two
                    http://localhost:8080/content/sample

                             Copy/Move
     curl -u admin:admin -F":operation=copy" -F":dest=/content/target"
                    http://localhost:8080/content/sample

                                 Delete
curl -u admin:admin -F":operation=delete" http://localhost:8080/content/target
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
Method
             Resource Path
             Selectors
             Extension
             Suffix

POST /content/project/test.page.html/cool
HTML
/content/sample.html
JSON
/content/sample.json
XML
/content/sample.xml
JCR
What no tables?
Putting it all together
Everything is content.
   Configuration
       Scripts
       Assets
    Everything.
Other fun OOTB Stuff

Authentication (form based, openid)
Scheduling (Quartz)
Version Control (JCR)
Other JVM Languages (EcmaScript,
Groovy, Scala.....)
Lets do some CODING!!
Recipe
  JDK 1.6
  Eclipse
   Maven
Apache Sling
     Git
 Bootstrap
   jQuery
  ckeditor
Installing Sling

          1) Place JAR in Directory

             2) java -jar -Xmx1024m
            -XX:MaxPermSize=256m
-agentlib:jdwp=transport=dt_socket,address=30
            303,server=y,suspend=n
  org.apache.sling.launchpad-6-standalone.jar
Generate Project Archetypes

1) Create Parent POM
2) Create module sling-initial-content-archetype
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
Create a Base Script

1) HTML boilerplate
2) Styles (bootstrap)
3) Any JavaScript
4) Test Content
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
Create a Build a New Page...Page

1) Create new Script
2) Add content node
3) Add to menu
Build an Image Upload Page

1) Create image upload script
2) Add content node
3) Add to menu
Making it Groovy!
(or Scala or Ruby or whatever
you're willing to implement with
            JSR 233)
Build a Menu that builds itself
                                    <%
          def resourceResolver = request.getResourceResolver();
def rootContent = resourceResolver.getResource("/content/slingdemo/home");

                                  %>
    <%
    rootContent.listChildren().each{ curRes ->
       if(curRes.isResourceType("slingdemo:base"))
       {
          def curPageNode = curRes.adaptTo(javax.jcr.Node);
          %>
          <li><a href="<%=curRes.getPath()%>.html"><%=
    curPageNode.getProperty("title").getString()%></a></li>
          <%
       }
    }
    %>
Make the Image Page Groovy
<%
    def resourceResolver = request.getResourceResolver();
    def rootContent =
resourceResolver.getResource("/content/slingdemo/assets/img");

%>

<%
        rootContent.listChildren().each{ curRes ->

%>
            <img src="<%= curRes.getPath()%>"/></br>
<%
            }
%>
References
                 https://github.com/bobpaulin/sling-cms-demo
                     http://sling.apache.org/site/index.html
http://dev.day.com/content/docs/en/cq/current/developing/sling_cheatsheet.html
Questions

 ??????
Thank You.

         Go forth and enjoy Sling

Email: bob@bobpaulin.com
Twitter: @bobpaulin
Linkedin: http://www.linkedin.com/in/bobpaulin
Blog: http://bobpaulin.com

More Related Content

What's hot

Rest and Sling Resolution
Rest and Sling ResolutionRest and Sling Resolution
Rest and Sling Resolution
DEEPAK KHETAWAT
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!
Jakub Kubrynski
 

What's hot (20)

Spring Framework Petclinic sample application
Spring Framework Petclinic sample applicationSpring Framework Petclinic sample application
Spring Framework Petclinic sample application
 
Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introduction
 
Spring boot
Spring bootSpring boot
Spring boot
 
Spring boot
Spring bootSpring boot
Spring boot
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with Spring
 
Spring Framework - Spring Security
Spring Framework - Spring SecuritySpring Framework - Spring Security
Spring Framework - Spring Security
 
스타트업 나홀로 데이터 엔지니어: 데이터 분석 환경 구축기 - 천지은 (Tappytoon) :: AWS Community Day Onlin...
스타트업 나홀로 데이터 엔지니어: 데이터 분석 환경 구축기 - 천지은 (Tappytoon) :: AWS Community Day Onlin...스타트업 나홀로 데이터 엔지니어: 데이터 분석 환경 구축기 - 천지은 (Tappytoon) :: AWS Community Day Onlin...
스타트업 나홀로 데이터 엔지니어: 데이터 분석 환경 구축기 - 천지은 (Tappytoon) :: AWS Community Day Onlin...
 
Spring boot
Spring bootSpring boot
Spring boot
 
Rest and Sling Resolution
Rest and Sling ResolutionRest and Sling Resolution
Rest and Sling Resolution
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introduction
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
4. 대용량 아키텍쳐 설계 패턴
4. 대용량 아키텍쳐 설계 패턴4. 대용량 아키텍쳐 설계 패턴
4. 대용량 아키텍쳐 설계 패턴
 
How to make APEX print through Node.js
How to make APEX print through Node.jsHow to make APEX print through Node.js
How to make APEX print through Node.js
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022
 
Node.js
Node.jsNode.js
Node.js
 
MongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineMongoDB - Aggregation Pipeline
MongoDB - Aggregation Pipeline
 
MongoDB Fundamentals
MongoDB FundamentalsMongoDB Fundamentals
MongoDB Fundamentals
 
RESTful API 제대로 만들기
RESTful API 제대로 만들기RESTful API 제대로 만들기
RESTful API 제대로 만들기
 

Viewers also liked

Apache Sling : JCR, OSGi, Scripting and REST
Apache Sling : JCR, OSGi, Scripting and RESTApache Sling : JCR, OSGi, Scripting and REST
Apache Sling : JCR, OSGi, Scripting and REST
Carsten Ziegeler
 
Hippo get together workshop automatic export
Hippo get together   workshop automatic exportHippo get together   workshop automatic export
Hippo get together workshop automatic export
Hippo
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repository
nobby
 

Viewers also liked (20)

Effective Web Application Development with Apache Sling
Effective Web Application Development with Apache SlingEffective Web Application Development with Apache Sling
Effective Web Application Development with Apache Sling
 
Apache Sling : JCR, OSGi, Scripting and REST
Apache Sling : JCR, OSGi, Scripting and RESTApache Sling : JCR, OSGi, Scripting and REST
Apache Sling : JCR, OSGi, Scripting and REST
 
JCR and Sling Quick Dive
JCR and Sling Quick DiveJCR and Sling Quick Dive
JCR and Sling Quick Dive
 
Apache Sling as a Microservices Gateway
Apache Sling as a Microservices GatewayApache Sling as a Microservices Gateway
Apache Sling as a Microservices Gateway
 
Rapid RESTful Web Applications with Apache Sling and Jackrabbit
Rapid RESTful Web Applications with Apache Sling and JackrabbitRapid RESTful Web Applications with Apache Sling and Jackrabbit
Rapid RESTful Web Applications with Apache Sling and Jackrabbit
 
JCR In 10 Minutes
JCR In 10 MinutesJCR In 10 Minutes
JCR In 10 Minutes
 
RESTful web apps with Apache Sling - 2013 version
RESTful web apps with Apache Sling - 2013 versionRESTful web apps with Apache Sling - 2013 version
RESTful web apps with Apache Sling - 2013 version
 
Hippo Presentation Jboye Study tour
Hippo Presentation Jboye Study tourHippo Presentation Jboye Study tour
Hippo Presentation Jboye Study tour
 
Hippo CMS at OpenCo Amsterdam 2014
Hippo CMS at OpenCo Amsterdam 2014Hippo CMS at OpenCo Amsterdam 2014
Hippo CMS at OpenCo Amsterdam 2014
 
Hippo get together workshop automatic export
Hippo get together   workshop automatic exportHippo get together   workshop automatic export
Hippo get together workshop automatic export
 
JCR In Action (ApacheCon US 2009)
JCR In Action (ApacheCon US 2009)JCR In Action (ApacheCon US 2009)
JCR In Action (ApacheCon US 2009)
 
Web Applications Development
Web Applications DevelopmentWeb Applications Development
Web Applications Development
 
What's new in JSR-283?
What's new in JSR-283?What's new in JSR-283?
What's new in JSR-283?
 
2008-12 OJUG JCR Demo
2008-12 OJUG JCR Demo2008-12 OJUG JCR Demo
2008-12 OJUG JCR Demo
 
Introducing Apricot, The Eclipse Content Management Platform
Introducing Apricot, The Eclipse Content Management PlatformIntroducing Apricot, The Eclipse Content Management Platform
Introducing Apricot, The Eclipse Content Management Platform
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repository
 
App and web with Hippo CMS and AngularJS
App and web with Hippo CMS and AngularJS App and web with Hippo CMS and AngularJS
App and web with Hippo CMS and AngularJS
 
JCR and ModeShape
JCR and ModeShapeJCR and ModeShape
JCR and ModeShape
 
Cms integration of apache solr how we did it.
Cms integration of apache solr   how we did it.Cms integration of apache solr   how we did it.
Cms integration of apache solr how we did it.
 
Introducing Hippo CMS 10.2
Introducing Hippo CMS 10.2Introducing Hippo CMS 10.2
Introducing Hippo CMS 10.2
 

Similar to Build Your Own CMS with Apache Sling

"Your script just killed my site" by Steve Souders
"Your script just killed my site" by Steve Souders"Your script just killed my site" by Steve Souders
"Your script just killed my site" by Steve Souders
Dmitry Makarchuk
 

Similar to Build Your Own CMS with Apache Sling (20)

JavaScript performance patterns
JavaScript performance patternsJavaScript performance patterns
JavaScript performance patterns
 
Sanjeev ghai 12
Sanjeev ghai 12Sanjeev ghai 12
Sanjeev ghai 12
 
JavaScript Performance Patterns
JavaScript Performance PatternsJavaScript Performance Patterns
JavaScript Performance Patterns
 
Taking your Web App for a walk
Taking your Web App for a walkTaking your Web App for a walk
Taking your Web App for a walk
 
Webpack
Webpack Webpack
Webpack
 
Google I/O 2012 - Protecting your user experience while integrating 3rd party...
Google I/O 2012 - Protecting your user experience while integrating 3rd party...Google I/O 2012 - Protecting your user experience while integrating 3rd party...
Google I/O 2012 - Protecting your user experience while integrating 3rd party...
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
 
Attractive HTML5~開発者の視点から~
Attractive HTML5~開発者の視点から~Attractive HTML5~開発者の視点から~
Attractive HTML5~開発者の視点から~
 
Web-Performance
Web-PerformanceWeb-Performance
Web-Performance
 
Writing your Third Plugin
Writing your Third PluginWriting your Third Plugin
Writing your Third Plugin
 
JavaScript Performance (at SFJS)
JavaScript Performance (at SFJS)JavaScript Performance (at SFJS)
JavaScript Performance (at SFJS)
 
JavaScript Perfomance
JavaScript PerfomanceJavaScript Perfomance
JavaScript Perfomance
 
The new static resources framework
The new static resources frameworkThe new static resources framework
The new static resources framework
 
"Your script just killed my site" by Steve Souders
"Your script just killed my site" by Steve Souders"Your script just killed my site" by Steve Souders
"Your script just killed my site" by Steve Souders
 
AFUP Lorraine - Symfony Webpack Encore
AFUP Lorraine - Symfony Webpack EncoreAFUP Lorraine - Symfony Webpack Encore
AFUP Lorraine - Symfony Webpack Encore
 
Modular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJSModular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJS
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
 
Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014
 
Fisl 11 - Dicas de Desenvolvimento Web com Ruby
Fisl 11 - Dicas de Desenvolvimento Web com RubyFisl 11 - Dicas de Desenvolvimento Web com Ruby
Fisl 11 - Dicas de Desenvolvimento Web com Ruby
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best Practices
 

More from Bob Paulin

Continuous delivery with Gradle
Continuous delivery with GradleContinuous delivery with Gradle
Continuous delivery with Gradle
Bob Paulin
 

More from Bob Paulin (12)

Fundraising At Apache
Fundraising At ApacheFundraising At Apache
Fundraising At Apache
 
Open Development When You're Not in Charge
Open Development When You're Not in ChargeOpen Development When You're Not in Charge
Open Development When You're Not in Charge
 
Apache When You're Not in Charge
Apache When You're Not in ChargeApache When You're Not in Charge
Apache When You're Not in Charge
 
Modular Open Source in Java for Now and Later
Modular Open Source in Java for Now and LaterModular Open Source in Java for Now and Later
Modular Open Source in Java for Now and Later
 
Microservice Networking in Anger
Microservice Networking in AngerMicroservice Networking in Anger
Microservice Networking in Anger
 
User Groups: The Gateway to Apache
User Groups: The Gateway to ApacheUser Groups: The Gateway to Apache
User Groups: The Gateway to Apache
 
What's My Modularity
What's My ModularityWhat's My Modularity
What's My Modularity
 
Do more with LESS, Handlebars, Coffeescript and other Web Resources in AEM
Do more with LESS, Handlebars, Coffeescript and other Web Resources in AEMDo more with LESS, Handlebars, Coffeescript and other Web Resources in AEM
Do more with LESS, Handlebars, Coffeescript and other Web Resources in AEM
 
Adding Modularity Afterward with Embedded OSGi
Adding Modularity Afterward with Embedded OSGiAdding Modularity Afterward with Embedded OSGi
Adding Modularity Afterward with Embedded OSGi
 
Continuous delivery with Gradle
Continuous delivery with GradleContinuous delivery with Gradle
Continuous delivery with Gradle
 
Frontend 'vs' Backend Getting the Right Mix
Frontend 'vs' Backend   Getting the Right MixFrontend 'vs' Backend   Getting the Right Mix
Frontend 'vs' Backend Getting the Right Mix
 
Code Quality Practice and Tools
Code Quality Practice and ToolsCode Quality Practice and Tools
Code Quality Practice and Tools
 

Recently uploaded

Recently uploaded (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Build Your Own CMS with Apache Sling

  • 1. “Build your own CMS with Apache Sling” By Bob Paulin Paulin Solutions LLC
  • 2. Independent Developer/Architect/Lead Focused on: Web Centric Application Development Mobile Development Support
  • 3. Stuff Sling doesn't give you BYO... Robust Login Security XSS Protection WYSIWYG Editors
  • 4. The Problem: I want to create a content driven website.
  • 6. STOP! Do one of these meet all of my needs or are they just part of the solution?
  • 7. Why not use a framework instead! SLING
  • 9. Best of Breed Apache Felix (OSGi) Apache Jackrabbit (JCR) REST
  • 10. Who's already using Sling? Adobe CQ 5
  • 11. How does Sling Work?
  • 12. Sling Post Servlet One stop shop for Content CRUD http://sling.apache.org/site/manipulating-content-the-slingpostservlet-servletspost.html
  • 13. Create/Modify curl -u admin:admin -Fmulti=one -Fmulti=two http://localhost:8080/content/sample Copy/Move curl -u admin:admin -F":operation=copy" -F":dest=/content/target" http://localhost:8080/content/sample Delete curl -u admin:admin -F":operation=delete" http://localhost:8080/content/target
  • 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
  • 20.
  • 21. Putting it all together
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27. Everything is content. Configuration Scripts Assets Everything.
  • 28. Other fun OOTB Stuff Authentication (form based, openid) Scheduling (Quartz) Version Control (JCR) Other JVM Languages (EcmaScript, Groovy, Scala.....)
  • 29. Lets do some CODING!!
  • 30. Recipe JDK 1.6 Eclipse Maven Apache Sling Git Bootstrap jQuery ckeditor
  • 31. Installing Sling 1) Place JAR in Directory 2) java -jar -Xmx1024m -XX:MaxPermSize=256m -agentlib:jdwp=transport=dt_socket,address=30 303,server=y,suspend=n org.apache.sling.launchpad-6-standalone.jar
  • 32. Generate Project Archetypes 1) Create Parent POM 2) Create module sling-initial-content-archetype
  • 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)
  • 39. Build a Menu that builds itself <% def resourceResolver = request.getResourceResolver(); def rootContent = resourceResolver.getResource("/content/slingdemo/home"); %> <% rootContent.listChildren().each{ curRes -> if(curRes.isResourceType("slingdemo:base")) { def curPageNode = curRes.adaptTo(javax.jcr.Node); %> <li><a href="<%=curRes.getPath()%>.html"><%= curPageNode.getProperty("title").getString()%></a></li> <% } } %>
  • 40. Make the Image Page Groovy <% def resourceResolver = request.getResourceResolver(); def rootContent = resourceResolver.getResource("/content/slingdemo/assets/img"); %> <% rootContent.listChildren().each{ curRes -> %> <img src="<%= curRes.getPath()%>"/></br> <% } %>
  • 41. References https://github.com/bobpaulin/sling-cms-demo http://sling.apache.org/site/index.html http://dev.day.com/content/docs/en/cq/current/developing/sling_cheatsheet.html
  • 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

Editor's Notes

  1. Sell yourself I write code I do design/architecture I lead teams I make development teams better.
  2. And that&apos;s a good thing because these are often things that we want to define.
  3. I want to build a website that people can go to and enter content. Without training, intuitive
  4. Lots of product options. Each has it&apos;s benefits Many can be stood up quickly out of the box. But what if I want to customize?
  5. Wait you just said the C word Customizing a product can be death by 1000 cuts depending on what you&apos;re doing.
  6. Frameworks offer a middle ground. They solve a problem but still grant you the flexibility to customize.
  7. So lets talk about sling
  8. Combination of open source projects to make content driven sites easier.
  9. 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.
  10. Very different mind set than your typical Web App. Content not MVC runs the show.
  11. So Sling is RESTful by design HTTP request to get data in and out GET - retrieve POST – Create/Modify
  12. Run simple curl commands Note we&apos;re creating a multi value field Display the urls through curl
  13. The most sophisticated part of the system. And the hardest to learn. But once you get it. Some incredibly hard problems become easy.
  14. 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&apos;re running. Suffix – a second path that is useful to identify additional content.
  15. Note that the multi field is missing. A Bug? Maybe I should submit a jira :).
  16. JCR is the persistence for sling. Underlying it is a file system or a Database. Can run on several Dbs. OOTB it&apos;s HSQL.
  17. 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.
  18. Lets trace what a homepage request will look like in our soon to be live CMS.
  19. Here is the structure Bot extend the JCR root Apps directory contains scripts: JSP, GSP, ESP.. could be more. Content directory contains content nodes.
  20. Request comes into sling and resolves to a node. That node looks at it&apos;s type then tries to resolve a script
  21. 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
  22. Ok we&apos;re looking for a node content that&apos;s a child of the node we asked for. Child also then resolves it&apos;s type
  23. Back to the script directory Selectors and extensions are once again used. If none are provided they are inherited from the parent. Page returns.
  24. It&apos;s a polygot programmers playground