How to get request parameter of SlingServlet in OSGi Service ? | Community
Skip to main content
Suraj_Kamdi
Community Advisor
Community Advisor
October 30, 2018

How to get request parameter of SlingServlet in OSGi Service ?

  • October 30, 2018
  • 1 reply
  • 12076 views

I want to fetch the properties in OSgi Service like userName , which is set in request parameter in a my custom SlingServlet ? Anyone has an idea about how to achieve this task ?

I have one RegisterUserSlingServlet class and CustomMailService as OSGi service. I want get some request parameters properties inside my CustomMailService.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

chandu_t
Level 3
October 30, 2018

Assuming you call CustomMailService in RegisterUserSlingServlet. You get request parameters in servlet by request.getParameter("key"). You can pass this parameters to the service, while invoking service method.

Feike_Visser1
Adobe Employee
Adobe Employee
October 30, 2018

Indeed, just pass in the request object or individual values

smacdonald2008
Level 10
October 31, 2018

@chandu t I dont want to append parameter in servlet. I only need to fetch that parameter in osgi service. I have to check some certain logic and based on that i have to append the targetUrl


You cannot read a servlet parameter value (value passed to a servlet) from an OSGI service. You can however - pass a servlet parameter from a servlet to a service method.