Skip to main content
October 16, 2015
解決済み

How to add path param to sling servlet url ?

  • October 16, 2015
  • 1 の返信
  • 5903 ビュー

How to add path param to sling servlet url ? 

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

このトピックへの返信は締め切られました。
ベストアンサー 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 の返信

smacdonald2008
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