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

Avatar

Avatar
Validate 1
Level 1
avantikas293534
Level 1

Likes

2 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
avantikas293534
Level 1

Likes

2 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
avantikas293534
Level 1

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
Coach
MVP
Arun_Patidar
MVP

Likes

1,442 likes

Total Posts

3,318 posts

Correct reply

941 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,442 likes

Total Posts

3,318 posts

Correct reply

941 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
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
Establish
MVP
Ravi_Pampana
MVP

Likes

197 likes

Total Posts

243 posts

Correct reply

75 solutions
Top badges earned
Establish
Contributor
Shape 1
Ignite 5
Ignite 3
View profile

Avatar
Establish
MVP
Ravi_Pampana
MVP

Likes

197 likes

Total Posts

243 posts

Correct reply

75 solutions
Top badges earned
Establish
Contributor
Shape 1
Ignite 5
Ignite 3
View profile
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
Coach
Employee
Jörg_Hoh
Employee

Likes

1,134 likes

Total Posts

3,161 posts

Correct reply

1,079 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,134 likes

Total Posts

3,161 posts

Correct reply

1,079 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
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