Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Day 10 - Sling Servlets (Part II) | AEM Community Blog Seeding

Avatar

Administrator

BlogImage.jpg

Day 10 - Sling Servlets (Part II) by Redquark

Abstract

In this post, we will take our discussion further and see how can we create servlets using resourceTypes.

What is a resource?
From the official docs,
The Resource is one of the central parts of Sling. Extending from JCR’s everything is Content, Sling assumes everything is a Resource.

Each resource has a resourceType which is used by the Servlet and Script resolver to find the appropriate Servlet or Script to handle the request for the Resource.
This means there can be many servlets in our application with unique resource types. Whenever our application uses that resourceType, that corresponding servlet will be executed.

Code Example
So, without further ado, let’s dive into an example of Sling Servlet which leverages resourceType. Let’s say, we have a TODO component that lists all the TODOs we have in our JCR repository (remember we stored the TODOs from external API in Day 08 - OSGi Components and Services).

Read Full Blog

Day 10 - Sling Servlets (Part II)

Q&A

Please use this thread to ask the related questions.



Kautuk Sahni
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

0 Replies