Message Boards
How can I redirect to any global URL from my portlet or through liferay?
How can I redirect to any global URL from my portlet or through liferay?
New Member Posts: 9 Join Date: 6/16/20 Recent PostsHi Team,
I want to redirect to any gloab like URL like 'www.google.com'
I have tried the following code to redirect to the
'www.google.com' but it is not redirecting.
@RenderMapping
public ModelAndView proxy(RenderRequest
request, RenderResponse response)
throws
PortalException, SystemException {
ModelAndView mv = new
ModelAndView();
try {
logger.debug("Redirecting to proxy page");
HttpServletResponse res =
PortalUtil.getHttpServletResponse(response);
res.sendRedirect("http://13.234.123.64:8080/cv/images/20201211-131135-2796/C0002007193A02.pdf");
} catch (Exception e) {
logger.error("proxyCVTempURL Error : {}", e);
}
return mv;
}
Can you please help me out to redirect to any URL.
RE: How can I redirect to any global URL from my portlet or through liferay
Junior Member Posts: 74 Join Date: 8/31/15 Recent PostsI guess it is not possible to do a redirect in the render lifecycle of a portlet. You have to do it in the action lifecycle.
As an alternative you can just put a little javascript code into your view.jsp and do your redirect there.
RE: How can I redirect to any global URL from my portlet or through liferay
Liferay Master Posts: 529 Join Date: 10/21/10 Recent PostsWhat is your use-case you want to achieve? Probably we can recommend alternative solution, but as Matthew wrote, basically you can do redirect in the action. Probably resource lifecycle can be also used, but again, please let us know about what is your use-case.