parent
4a4042d621
commit
b8b78f6653
|
@ -50,13 +50,12 @@ public class UserGuideController {
|
||||||
}
|
}
|
||||||
InputStream is = new FileInputStream(fileName);
|
InputStream is = new FileInputStream(fileName);
|
||||||
|
|
||||||
String[] filepath = fileName.split("\\.")[0].split("\\\\");
|
Path path = Paths.get(fileName);
|
||||||
String simplename = filepath[filepath.length - 1];
|
|
||||||
|
|
||||||
HttpHeaders responseHeaders = new HttpHeaders();
|
HttpHeaders responseHeaders = new HttpHeaders();
|
||||||
responseHeaders.setContentLength(is.available());
|
responseHeaders.setContentLength(is.available());
|
||||||
responseHeaders.setContentType(MediaType.TEXT_HTML);
|
responseHeaders.setContentType(MediaType.TEXT_HTML);
|
||||||
responseHeaders.set("Content-Disposition", "attachment;filename=" + simplename);
|
responseHeaders.set("Content-Disposition", "attachment;filename=" + path.getFileName().toString());
|
||||||
responseHeaders.set("Access-Control-Expose-Headers", "Content-Disposition");
|
responseHeaders.set("Access-Control-Expose-Headers", "Content-Disposition");
|
||||||
responseHeaders.get("Access-Control-Expose-Headers").add("Content-Type");
|
responseHeaders.get("Access-Control-Expose-Headers").add("Content-Type");
|
||||||
|
|
||||||
|
@ -71,7 +70,7 @@ public class UserGuideController {
|
||||||
@RequestMapping(value = "current", method = RequestMethod.POST)
|
@RequestMapping(value = "current", method = RequestMethod.POST)
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
ResponseEntity<ResponseItem<String>> updateGuide(@RequestBody UserGuide guide, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws Exception {
|
ResponseEntity<ResponseItem<String>> updateGuide(@RequestBody UserGuide guide, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws Exception {
|
||||||
String fileName = this.environment.getProperty("userguide.path") + guide.getName() + ".html";
|
String fileName = this.environment.getProperty("userguide.path") + guide.getName();
|
||||||
OutputStream os = new FileOutputStream(fileName);
|
OutputStream os = new FileOutputStream(fileName);
|
||||||
os.write(guide.getHtml().getBytes());
|
os.write(guide.getHtml().getBytes());
|
||||||
os.close();
|
os.close();
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue