Thanks @shashi_mulugu , but in real time, in which scenario we can use a resource type servlet with paths other than /content ??
Hi,
Resourcetypes-based servlets are recommended not just for ACL reasons, but also for other reasons.
In the case of a path servlet, there is no way to restrict users (OptinServlet can do that but they are very slow and less performant) and an additional dispatcher, OSGIconfig changes are required (if not using predefined whitelisted paths) and they are difficult to manage.
Create a servlet using resourcetype, which is most likely used with the sling:resourceType property via a jcr content resource.
It will be easy to add rep:cugPolicy to restrict in publish or rep:policy to restrict in Author for a few set of users.
For example if you want to create a dashboard/custom landing page in AEM author, you can restrict access based on user group.
If you are using Publish on a site with CUG, you can only allow anonymous users to check login status etc.
There are many real time use cases and advantages of resource based servlet. If you are create a resource in JCR, you are enabling capabilities on JCR and Sling.