Call SlingServlet without using /bin in sling.servlet.paths

Avatar

Avatar

avantikas293534

Avatar

avantikas293534

avantikas293534

10-07-2019

Hi All,

I am using "sling.servlet.paths=" + "/bin/xyz" to call my servlet using ajax. Is there any way to do it without using /bin i.e. "sling.servlet.paths=" + "/xyz" ? If yes, what are the steps that I need to follow to implement it.

Thanks

Avantika

Replies

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

3.1K

Likes

1.2K

Correct Reply

883

Avatar

Arun_Patidar

MVP

Total Posts

3.1K

Likes

1.2K

Correct Reply

883
Arun_Patidar
MVP

10-07-2019

Add your path in Execution Paths property in below osgi config

Apache Sling Servlet/Script Resolver and Error Handler

Avatar

Avatar

Ravi_Pampana

MVP

Avatar

Ravi_Pampana

MVP

Ravi_Pampana
MVP

10-07-2019

Hi,

You can also use selectors in your servlet so that you can be independent of path and more efficient than paths

sling.servlet.selectors

http://www.aemcq5tutorials.com/tutorials/sling-servlet-in-aem/

Avatar

Avatar

Jörg_Hoh

Employee

Total Posts

3.1K

Likes

1.1K

Correct Reply

1.1K

Avatar

Jörg_Hoh

Employee

Total Posts

3.1K

Likes

1.1K

Correct Reply

1.1K
Jörg_Hoh
Employee

10-07-2019

Please do not bind servlets to a path. Instead you should bind the servlet to a resourceType. See AEM coding best practice: Servlets | Things on a content management system

Jörg