@RequestMapping(value = "/image/get")
public void getImage(HttpServletRequest request,HttpServletResponse response) {
FileInputStream fis = null;
response.setContentType("image/gif");
try {
OutputStream out = response.getOutputStream();
ファイル file = new File("D:"+File.separator+"timg.jpg");
fis = new FileInputStream(file);
byte[] b = 新しい byte[fis.available()];
fis.read(b);
out.write(b);
out.flush();
} catch (例外 e) {
e.printStackTrace();
} 最後に {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}