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