SlideShare a Scribd company logo
1 of 28
Download to read offline
Content-Centric Web Development with
Apache Sling
1
07/09/2017
Koen Van Eeghem
Who am I?
2
Copyright © Capgemini 2017. All Rights Reserved
Koen Van Eeghem
DCX Consultant @ Capgemini - Atlas Copco Project since 09/2016
cown_ cown_ koenvaneeghem koen.van-eeghem@capgemini.com
3
Copyright © Capgemini 2017. All Rights Reserved
Planning
• What is Apache Sling?
• What makes Sling unique?
• Demo: Blog
4
What is Apache Sling?
5
Copyright © Capgemini 2017. All Rights Reserved
What is Apache Sling?
• REST based web framework
6
Copyright © Capgemini 2017. All Rights Reserved
What is Apache Sling?
• Content-driven, using a JCR1
content repository
• Implementation of the JSR 170 / 283 standard
• “best of both worlds”
• Hierarchically structured storage (node structure)
• Queryable
• != Content Management System
7
1 More on JCR: http://jackrabbit.apache.org/jcr/jcr-api.html
Copyright © Capgemini 2017. All Rights Reserved
What is Apache Sling?
• Content-driven, using a JCR1
content repository
• Implementation of the JSR 170 / 283 standard
• “best of both worlds”
• Hierarchically structured storage (node structure)
• Queryable
• != Content Management System
7
1 More on JCR: http://jackrabbit.apache.org/jcr/jcr-api.html
Copyright © Capgemini 2017. All Rights Reserved
What is Apache Sling?
• Powered by OSGi2
8
2 More on OSGi: https://www.osgi.org/developer/architecture
Copyright © Capgemini 2017. All Rights Reserved
What is Apache Sling?
• Scripting inside, multiple languages (JSP, ESP, Scala, etc.)
9
Copyright © Capgemini 2017. All Rights Reserved
What is Apache Sling?
• Apache Open Source project (since 2007)
• Originally developed by “Day Software”
10
What makes Sling unique?
11
Copyright © Capgemini 2017. All Rights Reserved
What makes Sling unique?
• “normal” frameworks resolve a servlet from the URL then try to load data
• localhost:8080/hello?name=Koen
12
Copyright © Capgemini 2017. All Rights Reserved
What makes Sling unique?
• Sling resolves a resource from the URL and renders it based on parameters
13
Copyright © Capgemini 2017. All Rights Reserved
What makes Sling unique?
• Sling resolves a resource from the URL and renders it based on parameters
13
Copyright © Capgemini 2017. All Rights Reserved
What makes Sling unique?
• Sling resolves a resource from the URL and renders it based on parameters
13
Copyright © Capgemini 2017. All Rights Reserved
What makes Sling unique?
• Sling models map a JCR node to a POJO
• Servlets can be defined on a certain resource or on a certain path
• Useful info can be provided by selectors
• Templates can be defined in multiple languages: HTL, JSP, ESP, …
• Html Templating Language (HTL1): easy binding between Java and front-end
14
1 More on HTL: https://sling.apache.org/documentation/bundles/scripting/scripting-htl.html
Demo: Blog
15
Copyright © Capgemini 2017. All Rights Reserved
Demo: Blog
• Basic blog with blogposts
• Sling Model for rendering blog posts
• Sling Servlet for returning a JSON list of blog posts without content
• All code can be found on GitHub
16
Copyright © Capgemini 2017. All Rights Reserved
Demo: Blog - Part 1; setting up your environment
• Download the Sling launchpad
• Start up the launchpad:
java -jar org.apache.sling.launchpad-9.jar
• localhost:8080/system/console/bundles
• Default credentials: admin / admin
17
Copyright © Capgemini 2017. All Rights Reserved
Demo: Blog - Part 1; Setting up your environment
• Generate a maven project: sling-bundle-archetype
• Delete whatever Java classes that were automatically created
• Create a run configuration to deploy your bundle:
18
Copyright © Capgemini 2017. All Rights Reserved
Demo: Blog - Part 2; Developing your bundle
• Create a folder for your models and a folder for your services
• Update your POM
• Specify the models’ location: <Sling-Model-Packages>
• Add the dependencies to use Sling Models:
• org.apache.sling.bnd.models
• org.apache.sling.models.api
19
Copyright © Capgemini 2017. All Rights Reserved
Demo: Blog - Part 2; Developing your bundle
• BlogPostModel.java
• @Model(adaptables = Resource.class): shows we’re mapping a resource
• @Inject: injected at runtime from the JCR resource
• @Optional: is not required for a “successful” instantiation
• @Named: has another name than the Java variable
20
Copyright © Capgemini 2017. All Rights Reserved
Demo: Blog - Part 3; Developing your HTL Template
21
Copyright © Capgemini 2017. All Rights Reserved
Demo: Blog - Part 4; Create some sample content
• 3 ways of administering content on your server:
1. WebDav client: good overview, limited options
2. HTTP methods: no feedback, but you can view/add
3. Deploy files: good overview and you can view/add
22
Copyright © Capgemini 2017. All Rights Reserved
Demo: Blog - Part 5; Extending your bundle with a servlet
• GetAllPostsServlet.java
• @SlingServlet(resourceTypes = "capgemini/blog", methods =
"GET", extensions = “json")
• extends SlingSafeMethodsServlet
• uses BlogPostService.java for getting projects
• uses Gson to return JSON (excludeFieldsWithoutExposeAnnotation())
23
/content/blog.json
Copyright © Capgemini 2017. All Rights Reserved
Demo: Blog - Part 6; Some final challenges
• Some articles were originally published somewhere else
→ add this in the model and template
• A customer wants webpages with “inspirational quotes” in a specific color
→ create a model and template for this
• A customer wants to be able to get the 3 most recent articles, with or without
details
→ adjust the JSON servlet to enable this with selectors
24
Thanks for your attention!
Questions?
25Don’t want to ask your question for the group? Just e-mail it to koen.van-eeghem@capgemini.com and i’ll be happy to reply!

More Related Content

What's hot

Microservices: Yes or not?
Microservices: Yes or not?Microservices: Yes or not?
Microservices: Yes or not?Eduard Tomàs
 
[Srijan Wednesday Webinar] How to Run Stateless and Stateful Services on K8S ...
[Srijan Wednesday Webinar] How to Run Stateless and Stateful Services on K8S ...[Srijan Wednesday Webinar] How to Run Stateless and Stateful Services on K8S ...
[Srijan Wednesday Webinar] How to Run Stateless and Stateful Services on K8S ...Srijan Technologies
 
Building a Web Frontend with Microservices and NGINX Plus
Building a Web Frontend with Microservices and NGINX PlusBuilding a Web Frontend with Microservices and NGINX Plus
Building a Web Frontend with Microservices and NGINX PlusNGINX, Inc.
 
Apache Continuum Build, Test, and Release
Apache Continuum Build, Test, and ReleaseApache Continuum Build, Test, and Release
Apache Continuum Build, Test, and Releaseelliando dias
 
Adobe Experience Manager - Replication deep dive
Adobe Experience Manager - Replication deep diveAdobe Experience Manager - Replication deep dive
Adobe Experience Manager - Replication deep divemwmd
 
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...Lucas Jellema
 
Swift UI in CloudStack
Swift UI in CloudStackSwift UI in CloudStack
Swift UI in CloudStackWill Stevens
 
A High-Performance Solution to Microservice UI Composition @ XConf Hamburg
A High-Performance Solution to Microservice UI Composition @ XConf HamburgA High-Performance Solution to Microservice UI Composition @ XConf Hamburg
A High-Performance Solution to Microservice UI Composition @ XConf HamburgDr. Arif Wider
 
Grails 3.0 Preview
Grails 3.0 PreviewGrails 3.0 Preview
Grails 3.0 Previewgraemerocher
 
Eduards Sizovs - Micro Service Architecture
Eduards Sizovs - Micro Service Architecture Eduards Sizovs - Micro Service Architecture
Eduards Sizovs - Micro Service Architecture DevConFu
 
Stop making, start composing - Using Composer for Drupal development
Stop making, start composing - Using Composer for Drupal developmentStop making, start composing - Using Composer for Drupal development
Stop making, start composing - Using Composer for Drupal developmentkaspergarnaes
 
Rapid Application Development on Google App Engine for Java
Rapid Application Development on Google App Engine for JavaRapid Application Development on Google App Engine for Java
Rapid Application Development on Google App Engine for JavaKunal Dabir
 
API Design in the Modern Era - Architecture Next 2020
API Design in the Modern Era - Architecture Next 2020API Design in the Modern Era - Architecture Next 2020
API Design in the Modern Era - Architecture Next 2020Eran Stiller
 
Easy Microservices with JHipster - Devoxx BE 2017
Easy Microservices with JHipster - Devoxx BE 2017Easy Microservices with JHipster - Devoxx BE 2017
Easy Microservices with JHipster - Devoxx BE 2017Deepu K Sasidharan
 
Microservices with Apache Camel, DDD, and Kubernetes
Microservices with Apache Camel, DDD, and KubernetesMicroservices with Apache Camel, DDD, and Kubernetes
Microservices with Apache Camel, DDD, and KubernetesChristian Posta
 
Micro service architecture - building scalable web solutions - George James -...
Micro service architecture - building scalable web solutions - George James -...Micro service architecture - building scalable web solutions - George James -...
Micro service architecture - building scalable web solutions - George James -...Red Blue Blur Ideas
 
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShiftReal-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShiftChristian Posta
 

What's hot (20)

Microservices: Yes or not?
Microservices: Yes or not?Microservices: Yes or not?
Microservices: Yes or not?
 
[Srijan Wednesday Webinar] How to Run Stateless and Stateful Services on K8S ...
[Srijan Wednesday Webinar] How to Run Stateless and Stateful Services on K8S ...[Srijan Wednesday Webinar] How to Run Stateless and Stateful Services on K8S ...
[Srijan Wednesday Webinar] How to Run Stateless and Stateful Services on K8S ...
 
Building a Web Frontend with Microservices and NGINX Plus
Building a Web Frontend with Microservices and NGINX PlusBuilding a Web Frontend with Microservices and NGINX Plus
Building a Web Frontend with Microservices and NGINX Plus
 
Apache Continuum Build, Test, and Release
Apache Continuum Build, Test, and ReleaseApache Continuum Build, Test, and Release
Apache Continuum Build, Test, and Release
 
Adobe Experience Manager - Replication deep dive
Adobe Experience Manager - Replication deep diveAdobe Experience Manager - Replication deep dive
Adobe Experience Manager - Replication deep dive
 
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
 
Short-Training asp.net vNext
Short-Training asp.net vNextShort-Training asp.net vNext
Short-Training asp.net vNext
 
Swift UI in CloudStack
Swift UI in CloudStackSwift UI in CloudStack
Swift UI in CloudStack
 
A High-Performance Solution to Microservice UI Composition @ XConf Hamburg
A High-Performance Solution to Microservice UI Composition @ XConf HamburgA High-Performance Solution to Microservice UI Composition @ XConf Hamburg
A High-Performance Solution to Microservice UI Composition @ XConf Hamburg
 
Grails 3.0 Preview
Grails 3.0 PreviewGrails 3.0 Preview
Grails 3.0 Preview
 
Eduards Sizovs - Micro Service Architecture
Eduards Sizovs - Micro Service Architecture Eduards Sizovs - Micro Service Architecture
Eduards Sizovs - Micro Service Architecture
 
Stop making, start composing - Using Composer for Drupal development
Stop making, start composing - Using Composer for Drupal developmentStop making, start composing - Using Composer for Drupal development
Stop making, start composing - Using Composer for Drupal development
 
Rapid Application Development on Google App Engine for Java
Rapid Application Development on Google App Engine for JavaRapid Application Development on Google App Engine for Java
Rapid Application Development on Google App Engine for Java
 
API Design in the Modern Era - Architecture Next 2020
API Design in the Modern Era - Architecture Next 2020API Design in the Modern Era - Architecture Next 2020
API Design in the Modern Era - Architecture Next 2020
 
Node.js Chapter1
Node.js Chapter1Node.js Chapter1
Node.js Chapter1
 
Easy Microservices with JHipster - Devoxx BE 2017
Easy Microservices with JHipster - Devoxx BE 2017Easy Microservices with JHipster - Devoxx BE 2017
Easy Microservices with JHipster - Devoxx BE 2017
 
Introduction to Grails
Introduction to GrailsIntroduction to Grails
Introduction to Grails
 
Microservices with Apache Camel, DDD, and Kubernetes
Microservices with Apache Camel, DDD, and KubernetesMicroservices with Apache Camel, DDD, and Kubernetes
Microservices with Apache Camel, DDD, and Kubernetes
 
Micro service architecture - building scalable web solutions - George James -...
Micro service architecture - building scalable web solutions - George James -...Micro service architecture - building scalable web solutions - George James -...
Micro service architecture - building scalable web solutions - George James -...
 
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShiftReal-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
 

Similar to Content-Centric Web Development with Apache Sling

Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems IntegrationJenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems IntegrationOleg Nenashev
 
Using OSGi for script deployment in Apache Sling
Using OSGi for script deployment in Apache SlingUsing OSGi for script deployment in Apache Sling
Using OSGi for script deployment in Apache SlingRadu Cotescu
 
Content-centric architectures - case study : Apache Sling
Content-centric architectures - case study : Apache SlingContent-centric architectures - case study : Apache Sling
Content-centric architectures - case study : Apache SlingFabrice Hong
 
AngularJS Beginners Workshop
AngularJS Beginners WorkshopAngularJS Beginners Workshop
AngularJS Beginners WorkshopSathish VJ
 
JS digest. Decemebr 2017
JS digest. Decemebr 2017JS digest. Decemebr 2017
JS digest. Decemebr 2017ElifTech
 
Untangling spring week11
Untangling spring week11Untangling spring week11
Untangling spring week11Derek Jacoby
 
Apigility-powered API's on IBM i
Apigility-powered API's on IBM iApigility-powered API's on IBM i
Apigility-powered API's on IBM ichukShirley
 
Eclipse Enterprise Content Repository (ECR)
Eclipse Enterprise Content Repository (ECR)Eclipse Enterprise Content Repository (ECR)
Eclipse Enterprise Content Repository (ECR)Florent Guillaume
 
Melbourne User Group OAK and MongoDB
Melbourne User Group OAK and MongoDBMelbourne User Group OAK and MongoDB
Melbourne User Group OAK and MongoDBYuval Ararat
 
Introduction+to+AngularJS+with+logo+from+digital+ocean.pdf
Introduction+to+AngularJS+with+logo+from+digital+ocean.pdfIntroduction+to+AngularJS+with+logo+from+digital+ocean.pdf
Introduction+to+AngularJS+with+logo+from+digital+ocean.pdfahmadfaisal744721
 
Cloud Native Camel Design Patterns
Cloud Native Camel Design PatternsCloud Native Camel Design Patterns
Cloud Native Camel Design PatternsBilgin Ibryam
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and SlingLo Ki
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and SlingLokesh BS
 
Learn from my Mistakes - Building Better Solutions in SPFx
Learn from my  Mistakes - Building Better Solutions in SPFxLearn from my  Mistakes - Building Better Solutions in SPFx
Learn from my Mistakes - Building Better Solutions in SPFxThomas Daly
 
CI_CONF 2012: Scaling
CI_CONF 2012: ScalingCI_CONF 2012: Scaling
CI_CONF 2012: ScalingChris Miller
 
API Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsAPI Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsApigee | Google Cloud
 
What is new in visual studio "14"
What is new in visual studio "14"What is new in visual studio "14"
What is new in visual studio "14"Praveen Nair
 

Similar to Content-Centric Web Development with Apache Sling (20)

Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems IntegrationJenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
 
Using OSGi for script deployment in Apache Sling
Using OSGi for script deployment in Apache SlingUsing OSGi for script deployment in Apache Sling
Using OSGi for script deployment in Apache Sling
 
Content-centric architectures - case study : Apache Sling
Content-centric architectures - case study : Apache SlingContent-centric architectures - case study : Apache Sling
Content-centric architectures - case study : Apache Sling
 
AngularJS Beginners Workshop
AngularJS Beginners WorkshopAngularJS Beginners Workshop
AngularJS Beginners Workshop
 
Intro to CakePHP
Intro to CakePHPIntro to CakePHP
Intro to CakePHP
 
JS digest. Decemebr 2017
JS digest. Decemebr 2017JS digest. Decemebr 2017
JS digest. Decemebr 2017
 
Untangling spring week11
Untangling spring week11Untangling spring week11
Untangling spring week11
 
Apigility-powered API's on IBM i
Apigility-powered API's on IBM iApigility-powered API's on IBM i
Apigility-powered API's on IBM i
 
Eclipse Enterprise Content Repository (ECR)
Eclipse Enterprise Content Repository (ECR)Eclipse Enterprise Content Repository (ECR)
Eclipse Enterprise Content Repository (ECR)
 
Melbourne User Group OAK and MongoDB
Melbourne User Group OAK and MongoDBMelbourne User Group OAK and MongoDB
Melbourne User Group OAK and MongoDB
 
Introduction+to+AngularJS+with+logo+from+digital+ocean.pdf
Introduction+to+AngularJS+with+logo+from+digital+ocean.pdfIntroduction+to+AngularJS+with+logo+from+digital+ocean.pdf
Introduction+to+AngularJS+with+logo+from+digital+ocean.pdf
 
Cloud Native Camel Design Patterns
Cloud Native Camel Design PatternsCloud Native Camel Design Patterns
Cloud Native Camel Design Patterns
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and Sling
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and Sling
 
Learn from my Mistakes - Building Better Solutions in SPFx
Learn from my  Mistakes - Building Better Solutions in SPFxLearn from my  Mistakes - Building Better Solutions in SPFx
Learn from my Mistakes - Building Better Solutions in SPFx
 
Agile sites2
Agile sites2Agile sites2
Agile sites2
 
CI_CONF 2012: Scaling - Chris Miller
CI_CONF 2012: Scaling - Chris MillerCI_CONF 2012: Scaling - Chris Miller
CI_CONF 2012: Scaling - Chris Miller
 
CI_CONF 2012: Scaling
CI_CONF 2012: ScalingCI_CONF 2012: Scaling
CI_CONF 2012: Scaling
 
API Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsAPI Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIs
 
What is new in visual studio "14"
What is new in visual studio "14"What is new in visual studio "14"
What is new in visual studio "14"
 

Recently uploaded

Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 

Recently uploaded (20)

Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 

Content-Centric Web Development with Apache Sling

  • 1. Content-Centric Web Development with Apache Sling 1 07/09/2017 Koen Van Eeghem
  • 3. Copyright © Capgemini 2017. All Rights Reserved Koen Van Eeghem DCX Consultant @ Capgemini - Atlas Copco Project since 09/2016 cown_ cown_ koenvaneeghem koen.van-eeghem@capgemini.com 3
  • 4. Copyright © Capgemini 2017. All Rights Reserved Planning • What is Apache Sling? • What makes Sling unique? • Demo: Blog 4
  • 5. What is Apache Sling? 5
  • 6. Copyright © Capgemini 2017. All Rights Reserved What is Apache Sling? • REST based web framework 6
  • 7. Copyright © Capgemini 2017. All Rights Reserved What is Apache Sling? • Content-driven, using a JCR1 content repository • Implementation of the JSR 170 / 283 standard • “best of both worlds” • Hierarchically structured storage (node structure) • Queryable • != Content Management System 7 1 More on JCR: http://jackrabbit.apache.org/jcr/jcr-api.html
  • 8. Copyright © Capgemini 2017. All Rights Reserved What is Apache Sling? • Content-driven, using a JCR1 content repository • Implementation of the JSR 170 / 283 standard • “best of both worlds” • Hierarchically structured storage (node structure) • Queryable • != Content Management System 7 1 More on JCR: http://jackrabbit.apache.org/jcr/jcr-api.html
  • 9. Copyright © Capgemini 2017. All Rights Reserved What is Apache Sling? • Powered by OSGi2 8 2 More on OSGi: https://www.osgi.org/developer/architecture
  • 10. Copyright © Capgemini 2017. All Rights Reserved What is Apache Sling? • Scripting inside, multiple languages (JSP, ESP, Scala, etc.) 9
  • 11. Copyright © Capgemini 2017. All Rights Reserved What is Apache Sling? • Apache Open Source project (since 2007) • Originally developed by “Day Software” 10
  • 12. What makes Sling unique? 11
  • 13. Copyright © Capgemini 2017. All Rights Reserved What makes Sling unique? • “normal” frameworks resolve a servlet from the URL then try to load data • localhost:8080/hello?name=Koen 12
  • 14. Copyright © Capgemini 2017. All Rights Reserved What makes Sling unique? • Sling resolves a resource from the URL and renders it based on parameters 13
  • 15. Copyright © Capgemini 2017. All Rights Reserved What makes Sling unique? • Sling resolves a resource from the URL and renders it based on parameters 13
  • 16. Copyright © Capgemini 2017. All Rights Reserved What makes Sling unique? • Sling resolves a resource from the URL and renders it based on parameters 13
  • 17. Copyright © Capgemini 2017. All Rights Reserved What makes Sling unique? • Sling models map a JCR node to a POJO • Servlets can be defined on a certain resource or on a certain path • Useful info can be provided by selectors • Templates can be defined in multiple languages: HTL, JSP, ESP, … • Html Templating Language (HTL1): easy binding between Java and front-end 14 1 More on HTL: https://sling.apache.org/documentation/bundles/scripting/scripting-htl.html
  • 19. Copyright © Capgemini 2017. All Rights Reserved Demo: Blog • Basic blog with blogposts • Sling Model for rendering blog posts • Sling Servlet for returning a JSON list of blog posts without content • All code can be found on GitHub 16
  • 20. Copyright © Capgemini 2017. All Rights Reserved Demo: Blog - Part 1; setting up your environment • Download the Sling launchpad • Start up the launchpad: java -jar org.apache.sling.launchpad-9.jar • localhost:8080/system/console/bundles • Default credentials: admin / admin 17
  • 21. Copyright © Capgemini 2017. All Rights Reserved Demo: Blog - Part 1; Setting up your environment • Generate a maven project: sling-bundle-archetype • Delete whatever Java classes that were automatically created • Create a run configuration to deploy your bundle: 18
  • 22. Copyright © Capgemini 2017. All Rights Reserved Demo: Blog - Part 2; Developing your bundle • Create a folder for your models and a folder for your services • Update your POM • Specify the models’ location: <Sling-Model-Packages> • Add the dependencies to use Sling Models: • org.apache.sling.bnd.models • org.apache.sling.models.api 19
  • 23. Copyright © Capgemini 2017. All Rights Reserved Demo: Blog - Part 2; Developing your bundle • BlogPostModel.java • @Model(adaptables = Resource.class): shows we’re mapping a resource • @Inject: injected at runtime from the JCR resource • @Optional: is not required for a “successful” instantiation • @Named: has another name than the Java variable 20
  • 24. Copyright © Capgemini 2017. All Rights Reserved Demo: Blog - Part 3; Developing your HTL Template 21
  • 25. Copyright © Capgemini 2017. All Rights Reserved Demo: Blog - Part 4; Create some sample content • 3 ways of administering content on your server: 1. WebDav client: good overview, limited options 2. HTTP methods: no feedback, but you can view/add 3. Deploy files: good overview and you can view/add 22
  • 26. Copyright © Capgemini 2017. All Rights Reserved Demo: Blog - Part 5; Extending your bundle with a servlet • GetAllPostsServlet.java • @SlingServlet(resourceTypes = "capgemini/blog", methods = "GET", extensions = “json") • extends SlingSafeMethodsServlet • uses BlogPostService.java for getting projects • uses Gson to return JSON (excludeFieldsWithoutExposeAnnotation()) 23 /content/blog.json
  • 27. Copyright © Capgemini 2017. All Rights Reserved Demo: Blog - Part 6; Some final challenges • Some articles were originally published somewhere else → add this in the model and template • A customer wants webpages with “inspirational quotes” in a specific color → create a model and template for this • A customer wants to be able to get the 3 most recent articles, with or without details → adjust the JSON servlet to enable this with selectors 24
  • 28. Thanks for your attention! Questions? 25Don’t want to ask your question for the group? Just e-mail it to koen.van-eeghem@capgemini.com and i’ll be happy to reply!