Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Subhash Shah
ActionResponse.sendRedirect() with post method
October 30, 2012 4:48 AM
Answer

Subhash Shah

Rank: Junior Member

Posts: 77

Join Date: November 29, 2011

Recent Posts

Hi All,

I am facing an issue and couldn't find solution. We have following code in one of our portlets:
 1
 2PortletURL url = ((ActionResponseImpl) actionResponse).createActionURL();
 3url.setParameter(SiriusRegistrationConstants.STRUTS_ACTION, "/login/login");
 4url.setParameter("saveLastPath", "0");
 5url.setParameter("redirect","/");
 6url.setParameter("login", screenName);
 7url.setParameter("password",password);
 8url.setParameter("rememberMe", "true");
 9actionResponse.sendRedirect(url);


Now the problem is when the following code is executed the URL in the browser address bar shows the parameters in the query string. Is there a way that this URL can be redirected using http POST method so that the parameters can't be seen in the address bar of the browser?

Thanks
Mika Koivisto
RE: ActionResponse.sendRedirect() with post method
October 31, 2012 4:46 PM
Answer

Mika Koivisto

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1501

Join Date: August 7, 2006

Recent Posts

You can't make redirect use POST. What you can do is render a html form to the browser with javascript to auto submit it.
Subhash Shah
RE: ActionResponse.sendRedirect() with post method
November 12, 2012 1:51 AM
Answer

Subhash Shah

Rank: Junior Member

Posts: 77

Join Date: November 29, 2011

Recent Posts

Thanks for the response. I have been able to implement it successfully as suggested.
Vishal Panchal
RE: ActionResponse.sendRedirect() with post method
November 12, 2012 7:43 AM
Answer

Vishal Panchal

Rank: Expert

Posts: 277

Join Date: May 20, 2012

Recent Posts

Mika Koivisto:
You can't make redirect use POST. What you can do is render a html form to the browser with javascript to auto submit it.


Hi All,

Useful stuff.

Thanks&Regards,
Vishal R. Panchal