下面的代码是浏览器请求一次可以返回一张图片,但是我需要返回多张。尝试过byte数组存list,返回list,但最终浏览器得不到图片。有什么办法能一次请求返回多张图片吗。
@RequestMapping(value = "/getShangHai",produces = MediaType.IMAGE_JPEG_VALUE)
@ResponseBody
public byte[] getImage() throws IOException {
File file = new File("C:\\Users\\123\\Desktop\\test003\\src\\main\\resources\\static\\img\\city\\上海\\上海外滩.jpeg");
FileInputStream inputStream = new FileInputStream(file);
byte[] bytes = new byte[inputStream.available()];
inputStream.read(bytes, 0, inputStream.available());
return bytes;
}