@@ -0,0 +1,1826 @@
+(/webapp/image)%0A%0Aimport static org.springframework.web.bind.annotation.RequestMethod.GET;%0A%0Aimport java.io.BufferedInputStream;%0Aimport java.io.BufferedOutputStream;%0Aimport java.io.File;%0Aimport java.io.FileInputStream;%0Aimport java.io.FileNotFoundException;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.net.URL;%0Aimport java.net.URLDecoder;%0A%0Aimport javax.servlet.ServletContext;%0Aimport javax.servlet.ServletOutputStream;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0A%0Aimport org.springframework.web.bind.annotation.PathVariable;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0Aimport org.springframework.web.bind.annotation.RestController;%0A%0Aimport vn.fjs.live.common.Constants;%0A%0A@RestController%0A@RequestMapping(value = %22/file%22)%0Apublic class FileController %7B%0A%0A%09@RequestMapping(method = GET, value = %22/%7BfileName:.+%7D%22)%0A%09public void getImage(HttpServletResponse response, HttpServletRequest request,%0A%09%09%09@PathVariable(%22fileName%22) String fileName) %7B%0A%09%09try %7B%0A%09%09%09String saveDirectory = request.getServletContext().getRealPath(%22/%22) + %22%5C%5Cimage%5C%5C%22;%0A%09%09%09File file = new File(saveDirectory, URLDecoder.decode(fileName, %22UTF-8%22));%0A%09%09%09if (file.exists()) %7B%0A%0A%09%09%09%09String contentType = request.getServletContext().getMimeType(file.getName());%0A%09%09%09%09response.setContentType(contentType);%0A%0A%09%09%09%09FileInputStream fin = new FileInputStream(file);%0A%09%09%09%09ServletOutputStream out = response.getOutputStream();%0A%09%09%09%09BufferedInputStream bin = new BufferedInputStream(fin);%0A%09%09%09%09BufferedOutputStream bout = new BufferedOutputStream(out);%0A%09%09%09%09int ch = 0;%0A%09%09%09%09while ((ch = bin.read()) != -1) %7B%0A%09%09%09%09%09bout.write(ch);%0A%09%09%09%09%7D%0A%09%09%09%09response.flushBuffer();%0A%09%09%09%09bin.close();%0A%09%09%09%09fin.close();%0A%09%09%09%09bout.close();%0A%09%09%09%09out.close();%0A%09%09%09%7D%0A%0A%09%09%7D catch (IOException e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%7D%0A%7D%0A

Create fileController.java