Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Adding custom execution path in Servlet Resolver

Avatar

Avatar
Validate 10
Level 2
priyag89962601
Level 2

Like

1 like

Total Posts

34 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 1
View profile

Avatar
Validate 10
Level 2
priyag89962601
Level 2

Like

1 like

Total Posts

34 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 1
View profile
priyag89962601
Level 2

06-12-2018

Hi,

I have created a Sling servlet and I need to register it using some custom path, e.g, /aem/testServlet

If I add this execution path entry in configuration "Apache Sling Servlet/Script Resolver and Error Handler", it works fine. But I need to create a custom configuration of this path for my project so that it can be deployed with the code.

Can anyone please help with this.

Accepted Solutions (0)

Answers (3)

Answers (3)

Avatar

Avatar
Validate 1
Level 2
papenaarun
Level 2

Likes

8 likes

Total Posts

18 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Validate 1
Level 2
papenaarun
Level 2

Likes

8 likes

Total Posts

18 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
papenaarun
Level 2

17-05-2021

Create an XML file with name org.apache.sling.servlets.resolver.SlingServletResolver in config folder.

Add servletresolver.paths property with your custom paths as specified below.

 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:OsgiConfig"
servletresolver.paths="[/custom/path]"
/>

 

Note: If you have already configured this manually in config manager console, and later trying to configure through code will not work. As, AEM tries to read from system rather from config folder.

In this case you have to delete the paths created in the CRX and then the paths will get configured through config folder.

 

 

Avatar

Avatar
Validate 10
Level 2
priyag89962601
Level 2

Like

1 like

Total Posts

34 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 1
View profile

Avatar
Validate 10
Level 2
priyag89962601
Level 2

Like

1 like

Total Posts

34 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 1
View profile
priyag89962601
Level 2

11-12-2018

I have already created this custom config and added the execution paths. But still it's picking up the OOTB SlingServletResolver, and my execution path is not getting registered.

Avatar

Avatar
Boost 5
Level 2
chandu_t
Level 2

Likes

7 likes

Total Posts

29 posts

Correct Reply

5 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 5
View profile

Avatar
Boost 5
Level 2
chandu_t
Level 2

Likes

7 likes

Total Posts

29 posts

Correct Reply

5 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 5
View profile
chandu_t
Level 2

06-12-2018

Hi,

You can create a OSGI Config and include in ur codebase.

/apps/my-project/config/org.apache.sling.servlets.resolver.SlingServletResolver.xml

with ur custom paths under servletresolver.paths