Sling Servlet using Resource Type in AEM.
Requests are handled by either script/Servlet in AEM. We can access servlets in two ways.
1. path
2. resourceType.
In this video I have covered how you can call Servlet using ResourceType using a selector.
When you deploy your servlet on a particular path it overrides rest of the parameters or rest of the attriubutes that could also be specified. So, you shoulp map your servlet with a particular resourceType and a particular selector. This will hide your servlet and make it only available to you on the webpage that are defined using that resource type and only when a particular selector string is present in the URL.
Follow the code to see the changes in the code. @slingservlet was used earlier till aem 6.2. Now onwards declarative service annotations are used. Create the class using this annotation and put the resourceType of page and selector and build the project.
Once success, open the page and put the selector sample in the url you will see the servlet has been called. This is the recommended of calling servlet using resourceType
In order to hide your servlet what you can do you can associate your servlet with the resourceType and selector this will prevent unauthorized access. Now a developer who knows the resourceType and selector combination will be able to call your serlet easily.
Copy the code from url : https://github.com/pankajchhatri/AEM
Servlets are registered as osgi service/bundle. Defining the servlet using scr annotations has been deprecated from aem 6.2 that's why I have used osgi declarative service annotations in this video.
share, support, like and subscribe
Subscribe : https://www.youtube.com/channel/UC5Lc...
LinkedIn : / pankaj-ch. .
Facebook : / pankajchhatri
Twitter : / pankajchhatri
Google plus : https://plus.google.com/u/0/+pankajch...
About : AEM/CQ5 tutorial is a youtube channel which helps you to learn AEM concepts theoretically as well as practically.
Follow the video to create sling servlet using path. In the next clip I will cover how to create servlet by resource path.
Смотрите видео 81. Sling Servlet using resourceType in AEM. онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь AEM and Devops Tutorial 31 Декабрь 2018, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 18,086 раз и оно понравилось 113 людям.