@RequestMapping(method=RequestMethod.GET, params="image") protected void displayImages(HttpServletRequest request, HttpServletResponse response){ String dir = getServletContext().getRealPath("/"); String fname = request.getParameter("name"); int iData = 0; //ServletのOutputStream取得 ServletOutputStream out = response.getOutputStream(); //画像ファイルをBufferedInputStreamを使用して読み取る BufferedInputStream in = new BufferedInputStream(new FileInputStream(dir+fname)); //画像を書き出す while((iData = in.read()) != -1){ out.write(iData); } in.close(); out.close(); }