本文整理汇总了Java中com.jfinal.config.Constants.setFreeMarkerViewExtension方法的典型用法代码示例。如果您正苦于以下问题:Java Constants.setFreeMarkerViewExtension方法的具体用法?Java Constants.setFreeMarkerViewExtension怎么用?Java Constants.setFreeMarkerViewExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jfinal.config.Constants
的用法示例。
在下文中一共展示了Constants.setFreeMarkerViewExtension方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configConstant
import com.jfinal.config.Constants; //导入方法依赖的package包/类
@Override
public void configConstant(Constants constants) {
// 设置freemarker模板
constants.setViewType(ViewType.FREE_MARKER); //默认的 可以不配置
constants.setBaseViewPath("/WEB-INF/template"); //页面模板根路径
constants.setFreeMarkerViewExtension("ftl"); //freemarker 模板后缀名
// 设置开发模式
loadPropertyFile("jdbc.properties"); // 加载系统属性配置文件,随后可用getProperty(...)获取值
constants.setDevMode(Boolean.valueOf(getProperty("devMode")));
}
示例2: configConstant
import com.jfinal.config.Constants; //导入方法依赖的package包/类
@Override
public void configConstant(Constants constants) {
// set config propertis.
configuration = GojaConfig.getConfigProps();
// dev_mode
final ApplicationMode applicationMode = GojaConfig.getApplicationMode();
final boolean isDev = applicationMode.isDev();
constants.setDevMode(isDev);
// fixed: render view has views//xxx.ftl
final String DEFAULT_VIEW_PATH = PageViewKit.WEBINF_DIR + "views";
viewPath = GojaConfig.getProperty(GojaPropConst.APP_VIEWPATH, DEFAULT_VIEW_PATH);
constants.setBaseViewPath(viewPath);
if (applicationMode.isProd()) {
// 404由于在开发模式下的提示信息,由于404触发的,所以在开发模式不启动404视图界面
constants.setError404View(PageViewKit.get404PageView());
}
constants.setError500View(PageViewKit.get500PageView());
constants.setError403View(PageViewKit.get403PageView());
appName = GojaConfig.getAppName();
// init wxchat config
final String wx_url = GojaConfig.getProperty(GojaPropConst.APP_WXCHAT_URL);
if (!Strings.isNullOrEmpty(wx_url)) {
// Config Wx Api
ApiConfigKit.setDevMode(isDev);
}
if (GojaConfig.isSecurity()) {
final Set<Class<? extends SecurityUserData>> securityUserClass = ClassPathScanning.scan(SecurityUserData.class);
if (CollectionUtils.isNotEmpty(securityUserClass)) {
for (Class<? extends SecurityUserData> securityUserClas : securityUserClass) {
try {
securityUserData = securityUserClas.newInstance();
break;
} catch (InstantiationException | IllegalAccessException e) {
logger.error("the security user data has error!", e);
}
}
}
}
final boolean jspViewType = GojaConfig.getPropertyToBoolean(GojaPropConst.APP_VIEW_JSP, false);
if (jspViewType) {
constants.setViewType(ViewType.JSP);
} else {
constants.setFreeMarkerViewExtension(".ftl");
setFtlSharedVariable();
}
if (isDev) {
constants.setErrorRenderFactory(new GojaErrorRenderFactory());
}
final int uploadMaxFileSize = GojaConfig.getPropertyToInt(GojaPropConst.APP_UPLOAD_MAXFILESIZE, Const.DEFAULT_MAX_POST_SIZE);
constants.setMaxPostSize(uploadMaxFileSize);
final String attachmentPath = GojaConfig.getProperty(GojaPropConst.APP_UPLOAD_PATH, "attachment");
constants.setBaseUploadPath(attachmentPath);
constants.setBaseDownloadPath(attachmentPath);
final String jsonMode = GojaConfig.getJsonMode();
if (!Strings.isNullOrEmpty(jsonMode)) {
if (StringUtils.equalsIgnoreCase("fastjson", jsonMode)) {
constants.setJsonFactory(new FastJsonFactory());
} else if (StringUtils.equalsIgnoreCase("jackson", jsonMode)) {
constants.setJsonFactory(new JacksonFactory());
}
}
final String fileRenamePolicy = GojaConfig.getProperty(GojaPropConst.APP_UPLOAD_FILERENAMEPOLICY, "default");
if (StringUtils.equalsIgnoreCase(fileRenamePolicy, "date")) {
OreillyCos.setFileRenamePolicy(new DateRandomFileRenamePolicy());
} else if (StringUtils.equalsIgnoreCase(fileRenamePolicy, "radom")) {
OreillyCos.setFileRenamePolicy(new RandomFileRenamePolicy());
} else if (StringUtils.equalsIgnoreCase(fileRenamePolicy, "default")) {
OreillyCos.setFileRenamePolicy(new DefaultFileRenamePolicy());
} else {
logger.warn("Upload folder naming of the unknown!");
}
}