Sling servlet by path and resourceType | Community
Skip to main content
manikanthar1295
Level 5
November 25, 2021
Solved

Sling servlet by path and resourceType

  • November 25, 2021
  • 2 replies
  • 3511 views

Hi,

 

There are 2 ways we can register our servlet by using path and resoureType.

AEM suggests always try to use resourceType registering servlet.

 

Can any one explain which Scenario is not achieved through resourceType then we we need to go to Path.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Kiran_Vedantam

Hi @manikanthar1295 

 

As you have mentioned, there are 2 ways to register a servlet (path and resource type). There are many advantages by binding a servlet to a resource type rather than a path discussed here: https://aem.redquark.org/2019/07/sling-servlet-04-registration-via.html

 

Main advantage is Acess control. If you do not want any access control over the servlet you can use PATH based approach.

 

Other use-cases can be the negation of the advantages that resource type can provide.

 

Thanks,

Kiran Vedantam.

2 replies

Kiran_Vedantam
Community Advisor
Kiran_VedantamCommunity AdvisorAccepted solution
Community Advisor
November 25, 2021

Hi @manikanthar1295 

 

As you have mentioned, there are 2 ways to register a servlet (path and resource type). There are many advantages by binding a servlet to a resource type rather than a path discussed here: https://aem.redquark.org/2019/07/sling-servlet-04-registration-via.html

 

Main advantage is Acess control. If you do not want any access control over the servlet you can use PATH based approach.

 

Other use-cases can be the negation of the advantages that resource type can provide.

 

Thanks,

Kiran Vedantam.

arunpatidar
Community Advisor
Community Advisor
November 27, 2021

Please registered all the servlet by resourceType.

This will allow you to easly manage path permissions thorugh dispatcher and easy to manage all the availble path

and if you are on AMS and AEMaaCS, one of the code quaility rule is not to registered sling servelt by path

https://experienceleague.adobe.com/docs/experience-manager-cloud-manager/using/how-to-use/custom-code-quality-rules.html?lang=en#do-not-use-sling-servlet-paths-to-register-servlets

 

Arun Patidar