How to add path param to sling servlet url ? | Community
Skip to main content
October 16, 2015
Solved

How to add path param to sling servlet url ?

  • October 16, 2015
  • 1 reply
  • 5878 views

How to add path param to sling servlet url ? 

eg, /services/demo/path/{var1}/{var2}.html

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 smacdonald2008

I assume you are looking for a similar way to place variables in paths of a URL - like you can with Spring - ie:

 @RequestMapping(value = "/{id}/ViewMyForm.do", method = RequestMethod.POST)

However - in Sling - a Request Parameter syntax is as follows. 

Request Parameters

A request parameter is like an input to a function. If you know you have some kind of operation that occurs at /get/me/some/info.json, you can attach request parameters to your GET request URI to retrieve the output of that servlet. For example, /get/me/some/info.json?on=football tells the servlet that you want some information on football.

- See more at:

http://www.citytechinc.com/us/en/blog/2013/08/apache-sling-selectors-request-parameters.html

http://stackoverflow.com/questions/20984706/is-it-possible-to-place-variables-into-a-resource-path-within-a-sling-servlet

1 reply

smacdonald2008
smacdonald2008Accepted solution
Level 10
October 16, 2015

I assume you are looking for a similar way to place variables in paths of a URL - like you can with Spring - ie:

 @RequestMapping(value = "/{id}/ViewMyForm.do", method = RequestMethod.POST)

However - in Sling - a Request Parameter syntax is as follows. 

Request Parameters

A request parameter is like an input to a function. If you know you have some kind of operation that occurs at /get/me/some/info.json, you can attach request parameters to your GET request URI to retrieve the output of that servlet. For example, /get/me/some/info.json?on=football tells the servlet that you want some information on football.

- See more at:

http://www.citytechinc.com/us/en/blog/2013/08/apache-sling-selectors-request-parameters.html

http://stackoverflow.com/questions/20984706/is-it-possible-to-place-variables-into-a-resource-path-within-a-sling-servlet