How to redirect to another Server from SpringController with Request Parameters

StackOverflow https://stackoverflow.com/questions/22229699

  •  06-06-2023
  •  | 
  •  

質問

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