-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
907 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,4 +37,5 @@ web/sim.pid | |
sim.pid | ||
.DS_Store | ||
.vscode | ||
tomcat.* | ||
tomcat.* | ||
/web/src/main/webapp/include/templates/default-2019/ |
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,6 @@ | ||
baseVersion=2.1 | ||
releaseVersion=${baseVersion}.${1} | ||
nextVersion=${baseVersion}.$((${1}+1)) | ||
./mvnw versions:set -DnewVersion=${releaseVersion} | ||
git add -A | ||
git commit -m '[shell-release]release version '${releaseVersion} |
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
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
103 changes: 103 additions & 0 deletions
103
web/src/main/java/com/zrlog/web/render/BlogFrontendFreeMarkerRender.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,103 @@ | ||
package com.zrlog.web.render; | ||
|
||
import com.jfinal.render.FreeMarkerRender; | ||
import com.jfinal.render.Render; | ||
import com.jfinal.render.RenderException; | ||
import freemarker.template.*; | ||
|
||
import javax.servlet.ServletContext; | ||
import java.io.PrintWriter; | ||
import java.util.*; | ||
|
||
public class BlogFrontendFreeMarkerRender extends Render { | ||
private static final String contentType = "text/html; charset=" + getEncoding(); | ||
private static final Configuration config = new Configuration(); | ||
|
||
public BlogFrontendFreeMarkerRender(String view) { | ||
this.view = view; | ||
} | ||
|
||
/** | ||
* freemarker can not load freemarker.properies automatically | ||
*/ | ||
public static Configuration getConfiguration() { | ||
return config; | ||
} | ||
|
||
public static void setProperties(Properties properties) { | ||
try { | ||
FreeMarkerRender.getConfiguration().setSettings(properties); | ||
} catch (TemplateException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
public static void init(ServletContext servletContext, Locale locale, int template_update_delay) { | ||
// Initialize the FreeMarker configuration; | ||
// - Create a configuration instance | ||
// config = new Configuration(); | ||
// - Templates are stoted in the WEB-INF/templates directory of the Web app. | ||
config.setServletContextForTemplateLoading(servletContext, "/"); // "WEB-INF/templates" | ||
// - Set update dealy to 0 for now, to ease debugging and testing. | ||
// Higher value should be used in production environment. | ||
|
||
if (getDevMode()) { | ||
config.setTemplateUpdateDelay(0); | ||
} | ||
else { | ||
config.setTemplateUpdateDelay(template_update_delay); | ||
} | ||
|
||
// - Set an error handler that prints errors so they are readable with | ||
// a HTML browser. | ||
// config.setTemplateExceptionHandler(TemplateExceptionHandler.HTML_DEBUG_HANDLER); | ||
config.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); | ||
|
||
// - Use beans wrapper (recommmended for most applications) | ||
config.setObjectWrapper(ObjectWrapper.BEANS_WRAPPER); | ||
// - Set the default charset of the template files | ||
config.setDefaultEncoding(getEncoding()); // config.setDefaultEncoding("ISO-8859-1"); | ||
// - Set the charset of the output. This is actually just a hint, that | ||
// templates may require for URL encoding and for generating META element | ||
// that uses http-equiv="Content-type". | ||
config.setOutputEncoding(getEncoding()); // config.setOutputEncoding("UTF-8"); | ||
// - Set the default locale | ||
config.setLocale(locale /* Locale.CHINA */ ); // config.setLocale(Locale.US); | ||
config.setLocalizedLookup(false); | ||
|
||
// 去掉int型输出时的逗号, 例如: 123,456 | ||
// config.setNumberFormat("#"); // config.setNumberFormat("0"); 也可以 | ||
config.setNumberFormat("#0.#####"); | ||
config.setDateFormat("yyyy-MM-dd"); | ||
config.setTimeFormat("HH:mm:ss"); | ||
config.setDateTimeFormat("yyyy-MM-dd HH:mm:ss"); | ||
} | ||
|
||
/** | ||
* 继承类可通过覆盖此方法改变 contentType,从而重用 freemarker 模板功能 | ||
* 例如利用 freemarker 实现 FreeMarkerXmlRender 生成 Xml 内容 | ||
*/ | ||
public String getContentType() { | ||
return contentType; | ||
} | ||
|
||
@SuppressWarnings({"unchecked", "rawtypes"}) | ||
public void render() { | ||
response.setContentType(getContentType()); | ||
|
||
Map data = new HashMap(); | ||
for (Enumeration<String> attrs = request.getAttributeNames(); attrs.hasMoreElements();) { | ||
String attrName = attrs.nextElement(); | ||
data.put(attrName, request.getAttribute(attrName)); | ||
} | ||
|
||
PrintWriter writer = null; | ||
try { | ||
Template template = config.getTemplate(view); | ||
writer = response.getWriter(); | ||
template.process(data, writer); // Merge the data-model and the template | ||
} catch (Exception e) { | ||
throw new RenderException(e); | ||
} | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+608 Bytes
(110%)
web/src/main/webapp/admin/summernote/font/summernote.woff
Binary file not shown.
Oops, something went wrong.