如何使用RestTemplate调用REST服务方法

时间:2013-04-09 07:24:39

标签: spring rest resttemplate

请告诉我如何使用RestTemplate调用以下服务方法。感谢。

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

1 个答案:

答案 0 :(得分: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