H5 page
<img th:src="files+'/'+${avatar}" ></img>
<span th:text="${session.user.userName}+',您好!'">张三,您好</span>
Server:
class above
@RequestMapping("/files")
method above
@GetMapping("/{filename:.+}")
@ResponseBody
public ResponseEntity<Resource> serveFile(@PathVariable String filename) {
Resource file = storageService.loadAsResource(filename);
return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION,
"attachment; filename=\"" + file.getFilename() + "\"").body(file);
}
主要是 url 拼接问题