window.open(url, ‘_blank’)
@RestController
public class PreviewLogic {
private static final Log LOG = LogFactory.getLog(PreviewLogic.class);
@Autowired
private FileProperties fileProperties;
@GetMapping("/preview")
public void preview(@RequestParam(value = "fileName") String fileName, HttpServletResponse response) {
LOG.info("盖章文件预览开始......");
String fileRootPath = fileProperties.getFilePath();
try (FileInputStream inputStream = new FileInputStream(fileRootPath + fileName)) {
byte[] data = new byte[inputStream.available()];
inputStream.read(data);
response.getOutputStream().write(data);
} catch (IOException e) {
LOG.info(e);
}
LOG.info("盖章文件预览结束......");
}
}