-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for static file parsing has been added
- Loading branch information
Showing
9 changed files
with
85 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/html/Html.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.xiaomi.youpin.docean.mvc.html; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import java.io.IOException; | ||
import java.nio.charset.StandardCharsets; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
/** | ||
* @author [email protected] | ||
* @date 2024/2/24 14:10 | ||
*/ | ||
@Slf4j | ||
public class Html { | ||
|
||
//读取指定html页面文件内容并返回 | ||
public static String view(String file) { | ||
try { | ||
Path path = Paths.get(file); | ||
return new String(Files.readAllBytes(path), StandardCharsets.UTF_8); | ||
} catch (IOException e) { | ||
log.error(e.getMessage(), e); | ||
e.printStackTrace(); | ||
return ""; | ||
} | ||
} | ||
|
||
//判断一个文件是否是.html文件,并且返回boolean值(class) | ||
public static boolean isHtmlFile(String filePath) { | ||
return filePath != null && filePath.toLowerCase().endsWith(".html"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,8 @@ demoVo=com.xiaomi.youpin.docean.test.demo.DemoVo | |
val=123 | ||
|
||
|
||
openStaticFile=true | ||
staticFilePath=/tmp/ | ||
|
||
|
||
|