Hi All,
Need some help with below scenario
We have a scenario where we are doing some internal forwards as below:
Example:
1. User hits /content/site/language/mypage.html
2. Based on some rules we are forwarding the request to /content/site/language/page
3. User still sees /content/site/language/mypage.html in browser url but the content is coming from
/content/site/language/page
Solved! Go to Solution.
Views
Replies
Total Likes
The correct solution is as below:
Found the issue. The request.getRequestDispatcher("/content/site/language/page").forward(request,response) does not invoke sling pipeline hence sling rewriter was not getting called.
We can use SlingRequestProcessor to get the response and this calls sling pipeline.
Can you check if you have restriction based on path?
try with global pipeline
Hi arunpatidar,
Found the issue. The request.getRequestDispatcher("/content/site/language/page").forward(request,response) does not invoke sling pipeline hence sling rewriter was not getting called.
We can use SlingRequestProcessor to get the response and this calls sling pipeline.
If you want the redirect url to be updated in url as well then you should be using sendRedirect() method of the servlet. Read this article to know more https://www.javatpoint.com/sendRedirect()-method#:~:text=Difference%20between%20forward()%20and%20se....
Hi DPrakashRaj,
The browser url should not be changed. This is working correctly. The urls present in the page content should be rewritten according to resolver rules.
Example
1.User hits /content/site/page1.html
2. Internally forward request to /content/site/page2.html
3.Browser still shows /content/site/page1.html however the content is coming from /content/site/page2.html
4.All the links in /content/site/page2.html should be rewritten.
@mmohta11 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
The correct solution is as below:
Found the issue. The request.getRequestDispatcher("/content/site/language/page").forward(request,response) does not invoke sling pipeline hence sling rewriter was not getting called.
We can use SlingRequestProcessor to get the response and this calls sling pipeline.
Views
Like
Replies
Views
Likes
Replies