Could any one suggest me that how to redirect to another server from spring MVC Controller?

I could redirect to another server by adding the below code in my controller

redirect:http://www.okay.com

but the problem is I would like to receive the request with parameters in another server.

没有正确的解决方案

其他提示

For using GET ,parameters can not be hidden. You can redirect through POST method. Go through example :

@RequestMapping(method = RequestMethod.POST)
public ModelAndView postRedirect(){
     String redirectUrl = "http://www.okay.com";
     RedirectView vf = new RedirectView(redirectUrl);
     vf.setStatusCode(HttpStatus.TEMPORARY_REDIRECT);
     ModelAndView md = new ModelAndView(vf);
     md.addObject("param1", "hello"); //Add your params here
     return md;
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top