この会話は、活動がないためロックされています。新しい投稿を作成してください。
この会話は、活動がないためロックされています。新しい投稿を作成してください。
Hi,
I am looking for a way to transform the current request URL into one with a different suffix and preserve everything else.
Does CQ (or Sling) has an API for doing this? Or do I have to do it manually, maybe with some help from slingRequest.getRequestPathInfo()?
Thanks,
Behrang
解決済! 解決策の投稿を見る。
表示
返信
いいね!の合計
You can get the suffix, selectors from the URL (https://sling.apache.org/apidocs/sling5/org/apache/sling/api/request/RequestPathInfo.html) but there is nothing to replace it. Hope you are already doing the same !
表示
返信
いいね!の合計
I am not aware of any such methods in APIs. you should handle it manually.
but can you explain a usecase here ?
表示
返信
いいね!の合計
We have a requirement to implement pagination and to use path variables rather than query parameters (e.g. /books/1, /books/2, etc. rather than /books?page=1, /books?page=2, etc.)
In this case, /1, /2, etc. are resolved as suffixes by CQ. So I need to extract the suffix and replace it. At the moment I am doing it manually, but it would be nice if there was a way to transform the current URL into another one with selector, suffix, etc. replaced with different values.
表示
返信
いいね!の合計
You can get the suffix, selectors from the URL (https://sling.apache.org/apidocs/sling5/org/apache/sling/api/request/RequestPathInfo.html) but there is nothing to replace it. Hope you are already doing the same !
表示
返信
いいね!の合計