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).
Please use this thread to ask the related questions.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes