Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Effective web application development with Apache Sling

352 visualizaciones

Publicado el

Apache Sling is an innovative web framework built on top of the Java Content Repository (JCR), that uses OSGi for its component model and fosters RESTful application design. This talk shows how Sling integrates various standard-based technologies, like OSGi and the Content Repository API for Java to create a coherent framework for web application development. We will walk through the development of a simple application with minimal effort and demonstrate how to productize the resulting application. We will pay special attention to some approaches which are not yet part of mainstream development, such as using OSGi for dependecy injection and JCR for persistence.

Publicado en: Software
  • Sé el primero en comentar

Effective web application development with Apache Sling

  1. 1. http://robert.muntea.nu @rombert Effective Web Application Development with Apache Sling Effective Web Application Development with Apache Sling Robert Munteanu, Adobe Systems CodeCamp Iași 2016
  2. 2. http://robert.muntea.nu @rombert Agenda ● What is Apache Sling? ● Content-Driven/RESTful applications ● What can Sling do for me? ● Demo ● Wrap-up
  3. 3. 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
  4. 4. http://robert.muntea.nu @rombert Modular
  5. 5. http://robert.muntea.nu @rombert RESTful
  6. 6. http://robert.muntea.nu @rombert Serve
  7. 7. http://robert.muntea.nu @rombert Library?
  8. 8. http://robert.muntea.nu @rombert Application Server?
  9. 9. http://robert.muntea.nu @rombert It’s Apache Sling!
  10. 10. http://robert.muntea.nu @rombert What is Apache Sling? Content-Driven RESTful applications Modularity Less @Magic, Fewer @Suprises Open Source
  11. 11. http://robert.muntea.nu @rombert History 2007 Incubation 2009 TLP 2015 Version 8 200x Pre-Apache
  12. 12. http://robert.muntea.nu @rombert Code statistics
  13. 13. 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
  14. 14. http://robert.muntea.nu @rombert What is a content-driven application?
  15. 15. http://robert.muntea.nu @rombert What is a not a content-driven application? ● HTTP proxy for anonymity ● Bitcoin miners ● Stock exchange trading
  16. 16. http://robert.muntea.nu @rombert What does a content-driven application consist of? Data Code
  17. 17. 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
  18. 18. http://robert.muntea.nu @rombert What is a resource? GET /news/sling/release-8.html HTTP/1.1
  19. 19. 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]
  20. 20. http://robert.muntea.nu @rombert Resources – User /users/admin.json Name: admin Last logged in: 2012-05-13T12:00:00Z Enabled: false
  21. 21. 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]
  22. 22. 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”
  23. 23. http://robert.muntea.nu @rombert Serving content – Controller-driven WelcomeController / UserController /users ArticleController /articles
  24. 24. http://robert.muntea.nu @rombert Serving content – resource-driven
  25. 25. 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]
  26. 26. 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
  27. 27. http://robert.muntea.nu @rombert Persistence using JCR
  28. 28. 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
  29. 29. http://robert.muntea.nu @rombert Pluggable repositories JCR MongoDB Couchbase Filesystem
  30. 30. http://robert.muntea.nu @rombert Pluggable authentication Oauth Form Oak External e.g. LDAP Basic HTTP
  31. 31. http://robert.muntea.nu @rombert Templating engines
  32. 32. http://robert.muntea.nu @rombert Others … ● Caching ● Eventing ● Logging ● Health Checks ● XSS protection ● Validation
  33. 33. http://robert.muntea.nu @rombert Developer Tools
  34. 34. http://robert.muntea.nu @rombert Deployment options
  35. 35. http://robert.muntea.nu @rombert Deployment Topologies - Standalone Sling + Oak Segment NodeStore HTTP Frontend (httpd, varnish, nginx, etc )
  36. 36. http://robert.muntea.nu @rombert Deployment Topologies HTTP Frontend (httpd, varnish, nginx, etc ) Sling + Oak Document NodeStore MongoDB Sling + Oak Document NodeStore
  37. 37. http://robert.muntea.nu @rombert Adminstrative web console
  38. 38. http://robert.muntea.nu @rombert Adminstrative web console
  39. 39. http://robert.muntea.nu @rombert Adminstrative web console
  40. 40. http://robert.muntea.nu @rombert Adminstrative web console
  41. 41. http://robert.muntea.nu @rombert Demo ● What is Apache Sling? ● Content-Driven/RESTful applications ● What can Sling do for me? ● Demo ● Wrap-up
  42. 42. http://robert.muntea.nu @rombert Resources ● https://sling.apache.org ● https://jackrabbit.apache.org/oak/ ● http://www.slideshare.net/rombertw/ ● @rombert

×