how to redirect to an external URL using POST in grails

拜拜、爱过 提交于 2019-12-02 03:29:15

问题


I am integrating my website with payment gateway...I want to take some parameters from the user and add some parameters from my side , and then send data to the payment gateway. But the problem is I can only send the data from server side using redirect using a GET but not POST, the payment gateway expects the data in the post form as data contains sensitive information...So how can I pass the data to payment gateway through POST??


回答1:


You can't redirect POST request, all redirections are new GET request, it's from specification.

Btw, you can add this parameters on client side, before sending to payment gateway. By using ajax for example. Or by making an extra page, with a form, that will be autosubmitted to payment gateway




回答2:


The two steps you need are: First while making ajax call add parameters from user in client side. Second add your required parameters on server-side. After that you can forward the details to your gateway.

def addYourParameters()
{
// did required operation here
forward controller:'gateway', action:'yourAction', params: [required Map]
}


来源:https://stackoverflow.com/questions/9820797/how-to-redirect-to-an-external-url-using-post-in-grails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!