0

I am looking for Apache Sling Api to build url and links. I have found a URLHandler and LinkUrl but i should install Adobe cq as bundle and this is not what i want.

Can any one recammand an API for URL? Thanks

Ayoub Abid
  • 432
  • 5
  • 15
  • Can you pls explain what you mean by building url and links ? Some example code that you're trying may help other people look at the issue. – Abhishek Apr 19 '16 at 15:25
  • http://wcm.io/handler/url/apidocs/io/wcm/handler/url/UrlHandler.html : something like that, this is for adobe cq, but i use only sling for this project – Ayoub Abid Apr 19 '16 at 17:39
  • I don't have experience with wcm.io but [this](http://wcm.io/) says that it is an open source project and you should be able to include this [library](http://mvnrepository.com/artifact/io.wcm/io.wcm.handler.url/0.5.0) as a dependency in your project. yes/no ? – Abhishek Apr 19 '16 at 18:25

1 Answers1

0

Depending on what you want to do with the URL, you can maybe have a look at Adobes Templating Language called "HTL" or "Sightly". There you can build urls like this.

<a href="${currentPage.path @selectors='mySelector', extension='json'}>...</a>

you can also attach request parameters by generating a map either in a Java class oder JavaScript and then add the @query='myModel.requestParameterMap'

I hope this will help you.

Tim
  • 287
  • 1
  • 13