replacing Felix annotations by OSGI R6 mannotations | Community
Skip to main content
Level 3
August 13, 2018
Solved

replacing Felix annotations by OSGI R6 mannotations

  • August 13, 2018
  • 2 replies
  • 2305 views

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

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 arunpatidar

Hi,

You can check Official OSGi Declarative Services Annotations in AEM - Adobe Experience Manager | AEM/CQ | Apache Sling 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

2 replies

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
August 13, 2018

Hi,

You can check Official OSGi Declarative Services Annotations in AEM - Adobe Experience Manager | AEM/CQ | Apache Sling 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

Arun Patidar
smacdonald2008
Level 10
August 13, 2018

Great response Arun!