Tôi mới đến mùa xuân. Tôi có một bộ điều khiển với một RequestMapping cho một số tham số GET. Chúng trả về một String. Nhưng một phương pháp cần trả về một tệp trong thư mục "/ res /". Làm thế nào để làm điều đó?Trả lại tệp từ Bộ điều khiển trong Mùa xuân
@RequestMapping(method = RequestMethod.GET,value = "/getfile")
public @ResponseBody
String getReviewedFile(@RequestParam("fileName") String fileName)
{
return //the File Content or better the file itself
}
Cảm ơn
Xem câu trả lời ở đây: http://stackoverflow.com/questions/5673260/downloading-a- file-from-spring-controllers –
Loại tệp nào? –