本文整理汇总了Java中com.jfinal.config.Constants类的典型用法代码示例。如果您正苦于以下问题:Java Constants类的具体用法?Java Constants怎么用?Java Constants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Constants类属于com.jfinal.config包,在下文中一共展示了Constants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configConstant
import com.jfinal.config.Constants; //导入依赖的package包/类
/** 配置常量 */
@Override
public void configConstant(Constants me) {
// 加载数据库配置,随后可用getProperty(...)获取值
super.loadPropertyFile("config.properties");
// 配置开发模式
me.setDevMode(super.getPropertyToBoolean("xyweixin.devMode", false));
// 设置视图类型为JSP,默认为FreeMarker
me.setViewType(ViewType.JSP);
// me.setEncoding("UTF-8");
me.setMainRenderFactory(new BeetlRenderFactory());
// 获取GroupTemplate ,可以设置共享变量等操作
// GroupTemplate groupTemplate = BeetlRenderFactory.groupTemplate;
// 配置文件上传的保存基路径
me.setUploadedFileSaveDirectory(super.getProperty("xyweixin.fileUploadDir", "upload"));
// me.setErrorView(401, "/au/login.html");
// me.setErrorView(403, "/au/login.html");
// me.setError404View("/404.html");
// me.setError500View("/500.html");
}
示例2: configConstant
import com.jfinal.config.Constants; //导入依赖的package包/类
/**
* 配置常量
*/
@Override
public void configConstant(Constants me) {
druidConfig = loadPropertyFile("config/bruid.properties");
// 加载少量必要配置,随后可用getProperty(...)获取值
me.setDevMode(getPropertyToBoolean("devMode", false));
me.setViewType(ViewType.JSP); // 设置视图类型为Jsp,否则默认为FreeMarker
me.setEncoding("UTF-8");
me.setBaseViewPath("/WEB-INF/pages");
me.setError404View("/404.jsp");
me.setError403View("/500.jsp");
me.setError500View("/500.jsp");
me.setError401View("/500.jsp");
JspRender.setSupportActiveRecord(false);
}
示例3: configConstant
import com.jfinal.config.Constants; //导入依赖的package包/类
/**
* 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) {
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());
//file upload dir
me.setBaseUploadPath(this.getUploadPath());
//file download dir
me.setBaseDownloadPath(this.getDownloadPath());
JFinalConfigExt.APP_NAME = this.getAppName();
//set file rename policy is random
OreillyCos.setFileRenamePolicy(new RandomFileRenamePolicy());
// config others
configMoreConstants(me);
}
示例4: configConstant
import com.jfinal.config.Constants; //导入依赖的package包/类
public void configConstant(Constants me) {
super.loadPropertyFile("a_little_config.txt");
//me.setDevMode(getPropertyToBoolean("devMode", false));
me.setDevMode(false);
// 配置统一异常页面
me.setError404View("/common/404.html");
// 配置微信 API 相关常量
ApiConfig.setDevMode(me.getDevMode());
ApiConfig.setUrl(getProperty("url"));
ApiConfig.setToken(getProperty("token"));
ApiConfig.setAppId(getProperty("appId"));
ApiConfig.setAppSecret(getProperty("appSecret"));
ApiConfig.setAgentId(getProperty("agentId"));
ApiConfig.setEncodingAESKey(getProperty("encodingAESKey"));
}
示例5: configConstant
import com.jfinal.config.Constants; //导入依赖的package包/类
@Override
public void configConstant(Constants me) {
loadPropertyFile("play.properties");
me.setDevMode(getPropertyToBoolean(Dict.CONFIG_JFINAL_MODE, false));
me.setBaseViewPath("static/app");
me.setMainRenderFactory(new BeetlRenderFactory(PathKit.getWebRootPath()));
}
示例6: 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")));
}
示例7: configConstant
import com.jfinal.config.Constants; //导入依赖的package包/类
/**
* 配置常量
*/
public void configConstant(Constants me) {
me.setDevMode(isDevMode());
me.setViewType(ViewType.JSP); // 设置视图类型为Jsp,否则默认为FreeMarker
me.setLogFactory(new Log4jLogFactory());
me.setError401View(Config.getStr("PAGES.401"));
me.setError403View(Config.getStr("PAGES.403"));
me.setError404View(Config.getStr("PAGES.404"));
me.setError500View(Config.getStr("PAGES.500"));
}
示例8: configConstant
import com.jfinal.config.Constants; //导入依赖的package包/类
public void configConstant(Constants constants) {
PropKit.use("custom/ooo.properties");
constants.setDevMode(true);// 开发模式
// constants.setViewType(ViewType.JSP);
constants.setViewType(ViewType.FREE_MARKER);
constants.setEncoding(AppConsts.ENCODE_CHARSET_UTF8);
}
示例9: configConstant
import com.jfinal.config.Constants; //导入依赖的package包/类
public void configConstant(Constants me) {
loadProp("a_little_config_pro.txt", "a_little_config.txt");
me.setDevMode(PropKit.getBoolean("devMode", false));
me.setViewType(ViewType.JSP);
// ApiConfigKit 设为开发模式可以在开发阶段输出请求交互的 xml 与 json 数据
ApiConfigKit.setDevMode(me.getDevMode());
//设置404跳转页面
me.setError404View("/_front/common/404.html");
me.setError500View("/_front/common/500.html");
}
示例10: configConstant
import com.jfinal.config.Constants; //导入依赖的package包/类
public void configConstant(Constants me) {
loadProp("a_little_config_pro.txt", "a_little_config.txt");
me.setDevMode(PropKit.getBoolean("devMode", false));
// ApiConfigKit 设为开发模式可以在开发阶段输出请求交互的 xml 与 json 数据
ApiConfigKit.setDevMode(me.getDevMode());
}
示例11: onConfigConstant
import com.jfinal.config.Constants; //导入依赖的package包/类
@Override
protected void onConfigConstant(Constants me) {
me.setBaseViewPath("/WEB-INF/pages");
me.setDevMode(PropKit.getBoolean("devMode", false));
me.setEncoding(Const.DEFAULT_ENCODING);
me.setError404View("/WEB-INF/error/404.html");
me.setError500View("/WEB-INF/error/500.html");
// freemarker add static template
Set<String> packages = new HashSet<>();
packages.add("com.codeyn.wechat.*.enums");
packages.add("com.codeyn.wechat.utils");
packages.add("com.codeyn.wechat.jfinal.bridger");
Set<Class<?>> clazzes = PackageScanner.scanPackage(packages.toArray(new String[packages.size()]));
for (Class<?> clazz : clazzes) {
TemplateHashModel tmp = buildStaticTemplate(clazz.getName());
FreeMarkerRender.getConfiguration().setSharedVariable(clazz.getSimpleName(), tmp);
}
// TODO download
me.setFileRenderPath("/download");
// TODO upload smartUpload
me.setUploadedFileSaveDirectory("/upload");
}
示例12: configConstant
import com.jfinal.config.Constants; //导入依赖的package包/类
@Override
public void configConstant(Constants me) {
// TODO Auto-generated method stub
me.setDevMode(true);
String hostName = MiscUtils.getHostName();
if(hostName.contains("wenjun") || hostName.contains("win7")) {
PropertyConfigurator.configure(loadPropertyFile("log4j-local.properties"));
}
}
示例13: configConstant
import com.jfinal.config.Constants; //导入依赖的package包/类
/**
* 配置常量
*/
@Override
public void configConstant(Constants me) {
WitRenderFactory factory = new WitRenderFactory(".wit");
//factory.setConfigPath("/WEB-INF/your/templates/path");
me.setMainRenderFactory(factory);
}
示例14: start
import com.jfinal.config.Constants; //导入依赖的package包/类
@Override
public boolean start() {
engine = new RythmEngine(conf);
engine.registerPropertyAccessor(new ActiveRecordPropAccessor());
Constants c = Config.getConstants();
c.setMainRenderFactory(new IMainRenderFactory() {
@Override
public Render getRender(String view) {
return new RythmRender(view);
}
@Override
public String getViewExtension() {
String ext = engine.conf().resourceNameSuffix();
if (S.empty(ext)) {
ext = ".html";
}
return ext;
}
});
if (conf.containsKey("rythm.i18n.enabled")) {
i18n = Boolean.parseBoolean(conf.get("rythm.i18n.enabled").toString());
if (i18n) {
Config.getInterceptors().add(new LocaleManager());
Object o = conf.get("rythm.i18n.param_name");
if (null != o) {
LocaleManager.setLocaleParamName(o.toString());
}
}
}
instance = this;
return true;
}
示例15: getConstants
import com.jfinal.config.Constants; //导入依赖的package包/类
public static Constants getConstants() {
return JFinalKit.constants;
}