com.jfinal.core.Const Java Examples

The following examples show how to use com.jfinal.core.Const. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JFinalConfigExt.java    From jfinal-ext3 with Apache License 2.0 5 votes vote down vote up
/**
 * Config constant
 * 
 * Default <br/>
 * ViewType: JSP <br/>
 * Encoding: UTF-8 <br/>
 * ErrorPages: <br/>
 * 404 : /WEB-INF/errorpages/404.jsp <br/>
 * 500 : /WEB-INF/errorpages/500.jsp <br/>
 * 403 : /WEB-INF/errorpages/403.jsp <br/>
 * UploadedFileSaveDirectory : cfg basedir + appName <br/>
 */
public void configConstant(Constants me) {
	//load properties
	this.loadPropertyFile();
	me.setViewType(ViewType.JSP);
	me.setDevMode(this.getAppDevMode());
	me.setEncoding(Const.DEFAULT_ENCODING);
	me.setError404View(PageViewKit.get404PageView());
	me.setError500View(PageViewKit.get500PageView());
	me.setError403View(PageViewKit.get403PageView());
	JFinalConfigExt.APP_NAME = this.getAppName();
	// config others
	configMoreConstants(me);
}
 
Example #2
Source File: ZrLogConfig.java    From zrlog with Apache License 2.0 5 votes vote down vote up
/**
 * 设置系统参数到Servlet的Context用于后台管理的主页面的展示,读取Zrlog的版本信息等。
 */
@Override
public void afterJFinalStart() {
    FreeMarkerRender.getConfiguration().setClassForTemplateLoading(ZrLogConfig.class, com.zrlog.common.Constants.FTL_VIEW_PATH);
    try {
        BlogFrontendFreeMarkerRender.getConfiguration().setDirectoryForTemplateLoading(new File(PathKit.getWebRootPath()));
        BlogFrontendFreeMarkerRender.init(JFinal.me().getServletContext(), Locale.getDefault(), Const.DEFAULT_FREEMARKER_TEMPLATE_UPDATE_DELAY);
    } catch (IOException e) {
        e.printStackTrace();
    }
    super.afterJFinalStart();
    if (isInstalled()) {
        initDatabaseVersion();
    }
    SYSTEM_PROP.setProperty("zrlog.runtime.path", PathKit.getWebRootPath());
    SYSTEM_PROP.setProperty("server.info", JFinal.me().getServletContext().getServerInfo());
    JFinal.me().getServletContext().setAttribute("system", SYSTEM_PROP);
    blogProperties.put("version", BlogBuildInfoUtil.getVersion());
    blogProperties.put("buildId", BlogBuildInfoUtil.getBuildId());
    blogProperties.put("buildTime", new SimpleDateFormat("yyyy-MM-dd").format(BlogBuildInfoUtil.getTime()));
    blogProperties.put("runMode", BlogBuildInfoUtil.getRunMode());
    JFinal.me().getServletContext().setAttribute("zrlog", blogProperties);
    JFinal.me().getServletContext().setAttribute("config", this);
    if (haveSqlUpdated) {
        int updatedVersion = ZrLogUtil.getSqlVersion(getUpgradeSqlBasePath());
        if (updatedVersion > 0) {
            new WebSite().updateByKV(com.zrlog.common.Constants.ZRLOG_SQL_VERSION_KEY, updatedVersion + "");
        }
    }
}
 
Example #3
Source File: CharacterEncodingFilter.java    From jboot-admin with Apache License 2.0 4 votes vote down vote up
@Override
protected void doFilterInternal(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
    request.setCharacterEncoding(Const.DEFAULT_ENCODING);
    chain.doFilter(request, response);
}
 
Example #4
Source File: P.java    From t-io with Apache License 2.0 4 votes vote down vote up
public static Prop append(String fileName) {
	return append(fileName, Const.DEFAULT_ENCODING);
}
 
Example #5
Source File: P.java    From t-io with Apache License 2.0 4 votes vote down vote up
public static Prop appendIfExists(String fileName) {
	return appendIfExists(fileName, Const.DEFAULT_ENCODING);
}
 
Example #6
Source File: P.java    From t-io with Apache License 2.0 4 votes vote down vote up
public static Prop append(File file) {
	return append(file, Const.DEFAULT_ENCODING);
}
 
Example #7
Source File: P.java    From t-io with Apache License 2.0 4 votes vote down vote up
public static Prop appendIfExists(File file) {
	return appendIfExists(file, Const.DEFAULT_ENCODING);
}
 
Example #8
Source File: P.java    From t-io with Apache License 2.0 2 votes vote down vote up
/**
 * Using the properties file. It will loading the properties file if not loading.
 * @see #use(String, String)
 */
public static Prop use(String fileName) {
	return use(fileName, Const.DEFAULT_ENCODING);
}
 
Example #9
Source File: P.java    From t-io with Apache License 2.0 2 votes vote down vote up
/**
 * Using the properties file bye File object. It will loading the properties file if not loading.
 * @see #use(File, String)
 */
public static Prop use(File file) {
	return use(file, Const.DEFAULT_ENCODING);
}