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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

replacing Felix annotations by OSGI R6 mannotations

Avatar

Level 3

Hi all,

I just want to have multiple selectors & multiple Method type in property attribute of @Component OSGI annotations. And here is the change I made. Is it right? will it work ? If not can anyone help me on this like what is expected?

@Component(service = {Servlet.class},

property = {

"sling.servlet.resourceTypes=" + "cq:Page",

"sling.servlet.selectors=" + HardwareConfiguratorJsonServlet.CONFIGURATOR_SELECTOR,

    HardwareConfiguratorJsonServlet.ONECLICKBUY_SELECTOR,

    HardwareConfiguratorJsonServlet.HARDWARE_SELECTOR,

"sling.servlet.extensions=" + "json",

"sling.servlet.methods=" + "POST",

"sling.servlet.methods=" + "GET"

})

public class HardwareConfiguratorJsonServlet extends AbstractJsonGeneratorServlet {

@SlingServlet(resourceTypes = "cq:Page",

    selectors = {HardwareConfiguratorJsonServlet.CONFIGURATOR_SELECTOR,

        HardwareConfiguratorJsonServlet.ONECLICKBUY_SELECTOR,

        HardwareConfiguratorJsonServlet.HARDWARE_SELECTOR},

    extensions = "json", methods = {"POST", "GET"})

public class HardwareConfiguratorJsonServlet extends AbstractJsonGeneratorServlet {

Thanks,

Vijay

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

You can check Official OSGi Declarative Services Annotations in AEM - Adobe Experience Manager | AEM/CQ | Apache S... and Apache Sling :: Servlets and Scripts

You can try below

sling.servlet.resourceTypes = [ "sling/unused" ] sling.servlet.selectors = [ "img", "tab" ] sling.servlet.extensions = [ "html", "txt", "json" ]

OR

"sling.servlet.selectors=img",

"sling.servlet.selectors=tab",

Thanks

Arun

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi,

You can check Official OSGi Declarative Services Annotations in AEM - Adobe Experience Manager | AEM/CQ | Apache S... and Apache Sling :: Servlets and Scripts

You can try below

sling.servlet.resourceTypes = [ "sling/unused" ] sling.servlet.selectors = [ "img", "tab" ] sling.servlet.extensions = [ "html", "txt", "json" ]

OR

"sling.servlet.selectors=img",

"sling.servlet.selectors=tab",

Thanks

Arun