Question

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.

No correct solution

OTHER TIPS

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;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top