Je suis nouveau au printemps. J'ai un contrôleur avec un RequestMapping pour plusieurs paramètres GET. Ils retournent une chaîne. Mais une méthode doit retourner un fichier dans le dossier "/ res /". Comment je fais ça?Renvoyer un fichier du contrôleur au printemps
@RequestMapping(method = RequestMethod.GET,value = "/getfile")
public @ResponseBody
String getReviewedFile(@RequestParam("fileName") String fileName)
{
return //the File Content or better the file itself
}
Merci
Voir la réponse ici: http://stackoverflow.com/questions/5673260/downloading-a- file-from-spring-controllers –
De quel type de fichier s'agit-il? –