2013-04-09 2 views
0

Может ли кто-нибудь сказать мне, как я могу вызвать следующий метод обслуживания с помощью RestTemplate. Благодарю.Как вызвать метод службы REST с помощью RestTemplate

@RequestMapping(value = "/file/upload", method = { RequestMethod.GET, RequestMethod.POST }) 
public String fileUpload(@RequestParam("file") MultipartFile file) { } 
+0

Вы смотрели в resttemplate? http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/remoting.html#rest-resttemplate http://docs.spring.io/spring-android/docs.old /1.0.x/reference/html/rest-template.html – ravi

ответ

0
RestTemplate rest = new RestTemplate(); 
ResponseEntity<youclass> response= rest.exhange(url(your url to post or get), data(data u r sending to server), yourclass.class); 
response.getBody() //response back from the server 
Смежные вопросы