Reputation: 1583
I have to call a remote service which expects me to send some parameters along with the URL, i.e.: HTTP://HOST:PORT/APPNAME/privado/loginAction.do?idioma=ES&CssSize=1&urlRespuesta=SOMEOTHERURL
How should I make the call from a controller in Spring MVC??
Obviously the host is not the same as the one in which my app is deployed...
Upvotes: 0
Views: 893
Reputation: 13501
If you need the controller to make the call, and not send a redirect, then you could use Apache Commons HttpClient, or if the other service is RESTful you could use Spring's RESTTemplate.
Upvotes: 1
Reputation: 1583
Well, in the end I did it somewhat like you suggest but this way:
return "redirect:/http://blablabla.com/loginAction.do"
Upvotes: 0
Reputation: 22720
In your controller you can use
response.sendRedirect("remote_server_url");
Its fine if host is not the same on which app is deployed.
Upvotes: 0