本文整理汇总了Java中com.jfinal.kit.PropKit类的典型用法代码示例。如果您正苦于以下问题:Java PropKit类的具体用法?Java PropKit怎么用?Java PropKit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropKit类属于com.jfinal.kit包,在下文中一共展示了PropKit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initXxlJobExecutor
import com.jfinal.kit.PropKit; //导入依赖的package包/类
private void initXxlJobExecutor() {
// registry jobhandler
XxlJobExecutor.registJobHandler("demoJobHandler", new DemoJobHandler());
XxlJobExecutor.registJobHandler("shardingJobHandler", new ShardingJobHandler());
// load executor prop
Prop xxlJobProp = PropKit.use("xxl-job-executor.properties");
// init executor
xxlJobExecutor = new XxlJobExecutor();
xxlJobExecutor.setIp(xxlJobProp.get("xxl.job.executor.ip"));
xxlJobExecutor.setPort(xxlJobProp.getInt("xxl.job.executor.port"));
xxlJobExecutor.setAppName(xxlJobProp.get("xxl.job.executor.appname"));
xxlJobExecutor.setAdminAddresses(xxlJobProp.get("xxl.job.admin.addresses"));
xxlJobExecutor.setLogPath(xxlJobProp.get("xxl.job.executor.logpath"));
xxlJobExecutor.setAccessToken(xxlJobProp.get("xxl.job.accessToken"));
// start executor
try {
xxlJobExecutor.start();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
示例2: start
import com.jfinal.kit.PropKit; //导入依赖的package包/类
@Override
public boolean start() {
try {
// 加载配置文件
Properties props = PropKit.use(config).getProperties();
QuartzKit.INSTANTS.sf = new StdSchedulerFactory(props);
// 获取Scheduler
sched = QuartzKit.INSTANTS.sf.getScheduler();
QuartzKit.INSTANTS.scheduler = sched;
log.info("QuartzKit.INSTANTS.scheduler:" + QuartzKit.INSTANTS.scheduler);
// 启动
sched.start();
return true;
} catch (Exception e) {
Throwables.propagate(e);
}
return false;
}
示例3: configPlugin
import com.jfinal.kit.PropKit; //导入依赖的package包/类
public void configPlugin(Plugins me) {
// 配置C3p0数据库连接池插件
C3p0Plugin c3p0Plugin = new C3p0Plugin(PropKit.get("jdbcUrl"), PropKit.get("user"), PropKit.get("password").trim());
me.add(c3p0Plugin);
// 配置ActiveRecord插件
ActiveRecordPlugin arp = new ActiveRecordPlugin(c3p0Plugin);
me.add(arp);
// EhCachePlugin ecp = new EhCachePlugin();
// me.add(ecp);
arp.addMapping("wechat_sys_user", SysUser.class);//映射wechat_sys_user表到SysUser模型(映射名字必须与数据库表名一致)
arp.addMapping("wechat_sys_log", Logs.class);
arp.addMapping("wechat_user_info", UserInfo.class);
arp.addMapping("wechat_public_account", PublicAccount.class);
arp.addMapping("wechat_req_msg_log", ReqMsgLog.class);
arp.addMapping("wechat_material", Material.class);
}
示例4: getApiConfig
import com.jfinal.kit.PropKit; //导入依赖的package包/类
/**
* 如果要支持多公众账号,只需要在此返回各个公众号对应的 ApiConfig 对象即可
* 可以通过在请求 url 中挂参数来动态从数据库中获取 ApiConfig 属性值
*/
public ApiConfig getApiConfig() {
ApiConfig ac = new ApiConfig();
// 配置微信 API 相关常量
ac.setToken(PropKit.get("token"));
ac.setAppId(PropKit.get("appId"));
ac.setAppSecret(PropKit.get("appSecret"));
/**
* 是否对消息进行加密,对应于微信平台的消息加解密方式:
* 1:true进行加密且必须配置 encodingAesKey
* 2:false采用明文模式,同时也支持混合模式
*/
ac.setEncryptMessage(PropKit.getBoolean("encryptMessage", false));
ac.setEncodingAesKey(PropKit.get("encodingAesKey", "setting it in config file"));
return ac;
}
示例5: init
import com.jfinal.kit.PropKit; //导入依赖的package包/类
@Override
public void init() throws Exception {
super.init();
String shiroConfigFile = GojaConfig.getAppSecurityConfig();
final File configFolderFile = GojaConfig.getConfigFolderFile();
shiroConfig = configFolderFile == null ? PropKit.use(shiroConfigFile).getProperties()
: PropKit.use(FileUtils.getFile(configFolderFile, shiroConfigFile)).getProperties();
WebSecurityManager webSecurityManager = initSecurityManager();
FilterChainManager manager = createFilterChainManager();
//Expose the constructed FilterChainManager by first wrapping it in a
// FilterChainResolver implementation. The AbstractShiroFilter implementations
// do not know about FilterChainManagers - only resolvers:
PathMatchingFilterChainResolver chainResolver = new PathMatchingFilterChainResolver();
chainResolver.setFilterChainManager(manager);
setSecurityManager(webSecurityManager);
setFilterChainResolver(chainResolver);
}
示例6: configConstant
import com.jfinal.kit.PropKit; //导入依赖的package包/类
@Override
public void configConstant(Constants me) {
PropKit.use("config.txt");
me.setViewType(ViewType.JSP);
//根据gt可以添加扩展函数,格式化函数,共享变量等,
me.setDevMode(true);
me.setJsonFactory(new JacksonFactory());
}
示例7: JbootScheduleManager
import com.jfinal.kit.PropKit; //导入依赖的package包/类
public JbootScheduleManager() {
config = Jboot.config(JbooScheduleConfig.class);
fixedScheduler = new ScheduledThreadPoolExecutor(config.getPoolSize());
Prop prop = null;
try {
prop = PropKit.use(config.getCron4jFile());
} catch (Throwable ex) {
}
cron4jPlugin = prop == null ? new Cron4jPlugin() : new Cron4jPlugin(prop);
}
示例8: dologin
import com.jfinal.kit.PropKit; //导入依赖的package包/类
public void dologin() {
ResultData result = new ResultData();
String addr = getPara("addr");
String password = getPara("password");
String pwd = PropKit.use("user.properties").get("root");
if (StrKit.isBlank(password) || !password.equals(pwd)) {
result.setSuccess(false);
result.setMessage("请输入正确的密码登陆!");
renderJson(result);
} else {
if (StrKit.notBlank(addr)) {
try {
ZKPlugin zkPlugin = new ZKPlugin(addr);
if (getSessionAttr("zk-client") == null) {
setSessionAttr("zk-client", zkPlugin.getClient());
setSessionAttr("addr", addr);
}
} catch (Exception e) {
log.error("ZKPlugin error.", e);
result.setSuccess(false);
result.setMessage("连接到ZooKeeper失败,请复核!");
}
} else {
result.setSuccess(false);
result.setMessage("ZooKeeper 地址不能为空!");
}
renderJson(result);
}
}
示例9: put
import com.jfinal.kit.PropKit; //导入依赖的package包/类
public static void put(Controller ctr, String key, String value, int maxAgeInSeconds) {
String encrypt_key = PropKit.get("encrypt_key");
String saveTime = System.currentTimeMillis() + "";
String encrypt_value = encrypt(encrypt_key, saveTime, maxAgeInSeconds + "", value);
String cookieValue = encrypt_value + COOKIE_SEPARATOR + saveTime + COOKIE_SEPARATOR + maxAgeInSeconds
+ COOKIE_SEPARATOR + value;
ctr.setCookie(key, cookieValue, maxAgeInSeconds);
}
示例10: get
import com.jfinal.kit.PropKit; //导入依赖的package包/类
public static String get(Controller ctr, String key) {
String encrypt_key = PropKit.get("encrypt_key");
String cookieValue = ctr.getCookie(key);
if (StringUtils.isNotBlank(cookieValue)) {
String cookieStrings[] = cookieValue.split(COOKIE_SEPARATOR);
if (null != cookieStrings && 4 == cookieStrings.length) {
String encrypt_value = cookieStrings[0];
String saveTime = cookieStrings[1];
String maxAgeInSeconds = cookieStrings[2];
String value = cookieStrings[3];
String encrypt = encrypt(encrypt_key, saveTime, maxAgeInSeconds, value);
// 保证 cookie 不被人为修改
if (encrypt_value != null && encrypt_value.equals(encrypt)) {
long stime = Long.parseLong(saveTime);
long maxtime = Long.parseLong(maxAgeInSeconds) * 1000;
// 查看是否过时
if ((stime + maxtime) - System.currentTimeMillis() > 0) {
return value;
}
}
}
}
return null;
}
示例11: configConstant
import com.jfinal.kit.PropKit; //导入依赖的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);
}
示例12: initialize
import com.jfinal.kit.PropKit; //导入依赖的package包/类
@Override
public void initialize() throws SQLException {
Prop prop = PropKit.use(DB_CONFIG);
druidPlugin = new DruidPlugin(prop.get("jdbcUrl"), prop.get("user"), prop.get("password"));
// StatFilter提供JDBC层的统计信息
druidPlugin.addFilter(new StatFilter());
// WallFilter的功能是防御SQL注入攻击
WallFilter wallFilter = new WallFilter();
wallFilter.setDbType("mysql");
druidPlugin.addFilter(wallFilter);
druidPlugin.start();
}
示例13: loadProp
import com.jfinal.kit.PropKit; //导入依赖的package包/类
/**
* 如果生产环境配置文件存在,则优先加载该配置,否则加载开发环境配置文件
* @param pro 生产环境配置文件
* @param dev 开发环境配置文件
*/
public void loadProp(String pro, String dev) {
try {
PropKit.use(pro);
}
catch (Exception e) {
PropKit.use(dev);
}
}
示例14: configConstant
import com.jfinal.kit.PropKit; //导入依赖的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");
}
示例15: configConstant
import com.jfinal.kit.PropKit; //导入依赖的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());
}