effective web application development with apache sling
Post on 14-Apr-2017
181 Views
Preview:
TRANSCRIPT
http://robert.muntea.nu @rombert
Effective Web Application Development with Apache Sling
Effective Web Application Developmentwith Apache Sling
Robert Munteanu, Adobe SystemsCodeCamp Iași 2016
http://robert.muntea.nu @rombert
Agenda
● What is Apache Sling?● Content-Driven/RESTful applications● What can Sling do for me?● Demo● Wrap-up
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
http://robert.muntea.nu @rombert
What is Apache Sling?
Content-DrivenRESTful applications Modularity
Less @Magic,Fewer @SuprisesOpen Source
http://robert.muntea.nu @rombert
History
2007Incubation
2009TLP
2015Version 8
200xPre-Apache
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
http://robert.muntea.nu @rombert
What is a not a content-driven application?
● HTTP proxy for anonymity● Bitcoin miners● Stock exchange trading
http://robert.muntea.nu @rombert
What does a content-driven application consist of?
Data Code
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
http://robert.muntea.nu @rombert
What is a resource?
GET /news/sling/release-8.html HTTP/1.1
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]
http://robert.muntea.nu @rombert
Resources – User
/users/admin.json
Name: admin Last logged in: 2012-05-13T12:00:00Z Enabled: false
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]
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”
http://robert.muntea.nu @rombert
Serving content – Controller-driven
WelcomeController/
UserController/users
ArticleController/articles
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]
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
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
http://robert.muntea.nu @rombert
Pluggable repositories
JCR
MongoDB
Couchbase
Filesystem
http://robert.muntea.nu @rombert
Pluggable authentication
Oauth
FormOak
Externale.g. LDAP
Basic HTTP
http://robert.muntea.nu @rombert
Others …
● Caching● Eventing● Logging● Health Checks● XSS protection● Validation
http://robert.muntea.nu @rombert
Deployment Topologies - Standalone
Sling + OakSegment NodeStore
HTTP Frontend(httpd, varnish, nginx, etc )
http://robert.muntea.nu @rombert
Deployment Topologies
HTTP Frontend(httpd, varnish, nginx, etc )
Sling + OakDocument NodeStore
MongoDB
Sling + OakDocument NodeStore
http://robert.muntea.nu @rombert
Demo
● What is Apache Sling?● Content-Driven/RESTful applications● What can Sling do for me?● Demo● Wrap-up
http://robert.muntea.nu @rombert
Resources
● https://sling.apache.org● https://jackrabbit.apache.org/oak/● http://www.slideshare.net/rombertw/ ● @rombert
top related