SlideShare a Scribd company logo
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 Plus
NGINX, Inc.
 
Apache Continuum Build, Test, and Release
Apache Continuum Build, Test, and ReleaseApache Continuum Build, Test, and Release
Apache Continuum Build, Test, and Release
elliando dias
 
Adobe Experience Manager - Replication deep dive
Adobe Experience Manager - Replication deep diveAdobe Experience Manager - Replication deep dive
Adobe Experience Manager - Replication deep dive
mwmd
 
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
 
Short-Training asp.net vNext
Short-Training asp.net vNextShort-Training asp.net vNext
Short-Training asp.net vNext
Betclic Everest Group Tech Team
 
Swift UI in CloudStack
Swift UI in CloudStackSwift UI in CloudStack
Swift UI in CloudStack
Will 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 Hamburg
Dr. Arif Wider
 
Grails 3.0 Preview
Grails 3.0 PreviewGrails 3.0 Preview
Grails 3.0 Preview
graemerocher
 
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 development
kaspergarnaes
 
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
Kunal 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 2020
Eran Stiller
 
Node.js Chapter1
Node.js Chapter1Node.js Chapter1
Node.js Chapter1
Talentica Software
 
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
Deepu K Sasidharan
 
Introduction to Grails
Introduction to GrailsIntroduction to Grails
Introduction to Grails
Hiten Pratap Singh
 
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
Christian 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 OpenShift
Christian 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 Integration
Oleg 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 Sling
Radu 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 Sling
Fabrice Hong
 
AngularJS Beginners Workshop
AngularJS Beginners WorkshopAngularJS Beginners Workshop
AngularJS Beginners Workshop
Sathish VJ
 
Intro to CakePHP
Intro to CakePHPIntro to CakePHP
Intro to CakePHP
Walther Lalk
 
JS digest. Decemebr 2017
JS digest. Decemebr 2017JS digest. Decemebr 2017
JS digest. Decemebr 2017
ElifTech
 
Untangling spring week11
Untangling spring week11Untangling spring week11
Untangling spring week11
Derek 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 i
chukShirley
 
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 MongoDB
Yuval Ararat
 
Tutorial Módulo 1 de Introdução com Flask
Tutorial Módulo 1 de Introdução com FlaskTutorial Módulo 1 de Introdução com Flask
Tutorial Módulo 1 de Introdução com Flask
Vinícius Marques
 
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
ahmadfaisal744721
 
Cloud Native Camel Design Patterns
Cloud Native Camel Design PatternsCloud Native Camel Design Patterns
Cloud Native Camel Design Patterns
Bilgin Ibryam
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and Sling
Lokesh BS
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and Sling
Lo Ki
 
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
Thomas Daly
 
Agile sites2
Agile sites2Agile sites2
Agile sites2
Michele Sciabarrà
 
CI_CONF 2012: Scaling - Chris Miller
CI_CONF 2012: Scaling - Chris MillerCI_CONF 2012: Scaling - Chris Miller
CI_CONF 2012: Scaling - Chris Miller
The Huffington Post Tech Team
 
CI_CONF 2012: Scaling
CI_CONF 2012: ScalingCI_CONF 2012: Scaling
CI_CONF 2012: Scaling
Chris 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 APIs
Apigee | Google Cloud
 

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
 
Tutorial Módulo 1 de Introdução com Flask
Tutorial Módulo 1 de Introdução com FlaskTutorial Módulo 1 de Introdução com Flask
Tutorial Módulo 1 de Introdução com Flask
 
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
 

Recently uploaded

Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
Requirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional SafetyRequirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional Safety
Ayan Halder
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
Peter Muessig
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
Marcin Chrost
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
TaghreedAltamimi
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 

Recently uploaded (20)

Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
Requirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional SafetyRequirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional Safety
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 

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!