<원문>http://nimba.tistory.com/m/post/457
@RequestMapping(value = "/servicelogo/{path1}/{file_name:.+}", method = RequestMethod.GET, produces = "application/octet-stream")
@ResponseBody
public FileSystemResource getPublicFile2(
@PathVariable("file_name") String fileName,
@PathVariable("path1") String path1,
HttpServletResponse response) throws Exception {
Map<String, Object> condition = new HashMap<String, Object>();
if(path1.equals("front")) {
condition.put("front_logo_img", fileName);
} else if(path1.equals("print")) {
condition.put("print_logo_img", fileName);
} else {
condition.put("front_logo_img", fileName);
}
String serverFileName = Admin2Service.getServiceLogoFileName(condition);
logger.debug("serverFileName= "+serverFileName);
if(serverFileName == null || serverFileName.length()==0 || serverFileName.equals("")) serverFileName = "temp.jpg";
String uploadDir = "/upload/serviceLogo";
File f = new File(messageBundle.getMessage("file.uploadPath") + uploadDir + "/" + serverFileName);
response.setContentType("application/octet-stream");
return new FileSystemResource(f);
}