effective web application development with apache sling robert … · @rombert effective web...
TRANSCRIPT
![Page 1: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/1.jpg)
http://robert.muntea.nu @rombert
Effective Web Application Development with Apache Sling
Effective Web Application Developmentwith Apache Sling
Robert Munteanu, Adobe SystemsApacheCon Core 2016
![Page 2: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/2.jpg)
http://robert.muntea.nu @rombert
Agenda
● What is Apache Sling?● Content-Driven/RESTful applications● What can Sling do for me?● Demo● Wrap-up
![Page 3: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/3.jpg)
http://robert.muntea.nu @rombert
What is Apache Sling?
● What is Apache Sling?● Content-Driven/RESTful applications● What can Sling do for me?● Demo● Wrap-up
![Page 10: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/10.jpg)
http://robert.muntea.nu @rombert
What is Apache Sling?
Content-DrivenRESTful applications Modularity
Less @Magic,Fewer @SuprisesOpen Source
![Page 11: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/11.jpg)
http://robert.muntea.nu @rombert
History
2007Incubation
2009TLP
2015Version 8
200xPre-Apache
![Page 14: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/14.jpg)
http://robert.muntea.nu @rombert
Content-driven, RESTful applications
● What is Apache Sling?● Content-Driven/RESTful applications● What can Sling do for me?● Demo● Wrap-up
![Page 16: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/16.jpg)
http://robert.muntea.nu @rombert
What is a not a content-driven application?
● HTTP proxy for anonymity● Bitcoin miners● Stock exchange trading
![Page 17: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/17.jpg)
http://robert.muntea.nu @rombert
What does a content-driven application consist of?
Data Code
![Page 18: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/18.jpg)
http://robert.muntea.nu @rombert
What is a resource?
● The smallest individually addressable unit● Minimally has a name● Key-value for properties● Optionally has a parent● Optionally has a child
![Page 19: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/19.jpg)
http://robert.muntea.nu @rombert
What is a resource?
GET /news/sling/release-8.html HTTP/1.1
![Page 20: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/20.jpg)
http://robert.muntea.nu @rombert
Resources – Blog post
/posts/hello_world.html
Title : Hello, world Body: ... Author [/users/admin] Publish date: 2016-01-01T23:00:00Z Comments [/comments/hello_world/resources] Images [/comments/hello_world/assets]
![Page 21: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/21.jpg)
http://robert.muntea.nu @rombert
Resources – User
/users/admin.json
Name: admin Last logged in: 2012-05-13T12:00:00Z Enabled: false
![Page 22: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/22.jpg)
http://robert.muntea.nu @rombert
Resources – Image
/assets/cat_laser_pointer.jpg
Name: Cat following laser pointer. LOL! Media type: image/jpeg Contents: <binary> Thumbs: [/assets/cat_laser_pointer/renditions]
![Page 23: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/23.jpg)
http://robert.muntea.nu @rombert
Serving content – Controller-driven
@GetMethod@AtLocation(“/users/{name}.html”)public byte[] handleUser(String name) { … }
map “users”map “articles” as “news”GET “images”
![Page 24: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/24.jpg)
http://robert.muntea.nu @rombert
Serving content – Controller-driven
WelcomeController/
UserController/users
ArticleController/articles
![Page 26: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/26.jpg)
http://robert.muntea.nu @rombert
Serving content – resource-driven
/ [sling:redirect]
content [my/site/listing] news [my/site/listing]
sling-launchpad-8 [my/site/article] sling-ide-tooling-11 [my/site/article]
assets [sling:Folder] sling_logo.png [nt:file]
![Page 27: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/27.jpg)
http://robert.muntea.nu @rombert
What can Sling do for me?
● What is Apache Sling?● Content-Driven/RESTful applications● What can Sling do for me?● Demo● Wrap-up
![Page 29: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/29.jpg)
http://robert.muntea.nu @rombert
Modularity with OSGi
● The solution we chose for modularity and services● Comes with lots of add-ons:
● Eventing● Administrative console● Configuration● Hot deployment● etc
● Forces application to handle the “real-world” dynamics● Easy configuration using annotations
![Page 30: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/30.jpg)
http://robert.muntea.nu @rombert
Pluggable repositories
JCR
MongoDB
Couchbase
Filesystem
![Page 31: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/31.jpg)
http://robert.muntea.nu @rombert
Pluggable authentication
Oauth
FormOak
Externale.g. LDAP
Basic HTTP
![Page 33: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/33.jpg)
http://robert.muntea.nu @rombert
Others …
● Caching● Eventing● Logging● Health Checks● XSS protection● Validation
![Page 36: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/36.jpg)
http://robert.muntea.nu @rombert
Deployment Topologies - Standalone
Sling + OakSegment NodeStore
HTTP Frontend(httpd, varnish, nginx, etc )
![Page 37: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/37.jpg)
http://robert.muntea.nu @rombert
Deployment Topologies
HTTP Frontend(httpd, varnish, nginx, etc )
Sling + OakDocument NodeStore
MongoDB
Sling + OakDocument NodeStore
![Page 42: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/42.jpg)
http://robert.muntea.nu @rombert
Demo
● What is Apache Sling?● Content-Driven/RESTful applications● What can Sling do for me?● Demo● Wrap-up
![Page 43: Effective Web Application Development with Apache Sling Robert … · @rombert Effective Web Application Development with Apache Sling Effective Web Application Development](https://reader030.vdocuments.site/reader030/viewer/2022041100/5ed6f2198202d15f2d65485f/html5/thumbnails/43.jpg)
http://robert.muntea.nu @rombert
Resources
● https://sling.apache.org● https://jackrabbit.apache.org/oak/● http://www.slideshare.net/rombertw/ ● @rombert