本文整理汇总了Java中com.jfinal.kit.PropKit类的典型用法代码示例。如果您正苦于以下问题:Java PropKit类的具体用法?Java PropKit怎么用?Java PropKit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropKit类属于com.jfinal.kit包,在下文中一共展示了PropKit类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:mmwhd,项目名称:stage-job,代码行数:25,代码来源:JFinalCoreConfig.java
示例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;
}
开发者ID:gumutianqi,项目名称:jfinal-plus,代码行数:25,代码来源:DynamicQuartzPlugin.java
示例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);
}
开发者ID:touzi,项目名称:weChat,代码行数:17,代码来源:WeixinConfig.java
示例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;
}
开发者ID:touzi,项目名称:weChat,代码行数:22,代码来源:WeixinApiController.java
示例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);
}
开发者ID:GojaFramework,项目名称:goja,代码行数:23,代码来源:GojaShiroFilter.java
示例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());
}
开发者ID:readen,项目名称:Relay,代码行数:9,代码来源:AppConfig.java
示例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);
}
开发者ID:yangfuhai,项目名称:jboot,代码行数:13,代码来源:JbootScheduleManager.java
示例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);
}
}
开发者ID:iminto,项目名称:zooadmin,代码行数:31,代码来源:IndexController.java
示例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);
}
开发者ID:lusparioTT,项目名称:OooO,代码行数:12,代码来源:CookieUtils.java
示例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;
}
开发者ID:lusparioTT,项目名称:OooO,代码行数:29,代码来源:CookieUtils.java
示例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);
}
开发者ID:lusparioTT,项目名称:OooO,代码行数:9,代码来源:AppConfig.java
示例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();
}
开发者ID:gumutianqi,项目名称:jfinal-plus,代码行数:14,代码来源:QuartzConnectionProvider.java
示例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);
}
}
开发者ID:touzi,项目名称:weChat,代码行数:14,代码来源:WeixinConfig.java
示例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");
}
开发者ID:touzi,项目名称:weChat,代码行数:12,代码来源:WeixinConfig.java
示例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());
}
开发者ID:touzi,项目名称:weChat,代码行数:8,代码来源:WeixinConfig.java
示例16: encaAuthorizeUrl
import com.jfinal.kit.PropKit; //导入依赖的package包/类
/**
* 封装微信认证重定向URL
*/
public static String encaAuthorizeUrl(String appId, WcJFinalBaseController wxJFinalBaseController) {
StringBuilder redirectUrl = new StringBuilder();
redirectUrl.append(PropKit.get("wx.oauth2.authorize.url"));
redirectUrl.append("?appid=").append(appId);
redirectUrl.append("&redirect_uri=").append(getSourceUrl(wxJFinalBaseController));
redirectUrl.append("&response_type=code&scope=snsapi_base&state=wx#wechat_redirect");
logger.info("wx request:" + redirectUrl.toString());
return redirectUrl.toString();
}
开发者ID:efsn,项目名称:wechat-standard,代码行数:13,代码来源:WcUtil.java
示例17: getOpenId
import com.jfinal.kit.PropKit; //导入依赖的package包/类
/**
* 获取openId
*/
public static String getOpenId(WcConfig wxConfig, String code) {
StringBuilder sbUrl = new StringBuilder();
sbUrl.append(PropKit.get("wx.oauth2.access.token.url")).append("&appid=").append(wxConfig.getStr("app_id"));
sbUrl.append("&secret=").append(wxConfig.getStr("app_secret"));
sbUrl.append("&code=").append(code);
String jsonResult = HttpKit.get(sbUrl.toString());
logger.info("wx request:" + jsonResult);
JSONObject jsonTexts = (JSONObject) JSON.parse(jsonResult);
return String.valueOf(jsonTexts.get("openid"));
}
开发者ID:efsn,项目名称:wechat-standard,代码行数:15,代码来源:WcUtil.java
示例18: onConfigConstant
import com.jfinal.kit.PropKit; //导入依赖的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");
}
开发者ID:efsn,项目名称:wechat-standard,代码行数:28,代码来源:WcFrontJFinalConfig.java
示例19: configPlugin
import com.jfinal.kit.PropKit; //导入依赖的package包/类
@Override
public void configPlugin(Plugins me) {
loadPropertyFile("config.txt");
RedisPlugin redisPlugin=new RedisPlugin("default",PropKit.get("redisHost"));
me.add(redisPlugin);
}
开发者ID:readen,项目名称:Relay,代码行数:7,代码来源:AppConfig.java
示例20: getPropertyToBoolean
import com.jfinal.kit.PropKit; //导入依赖的package包/类
public static Boolean getPropertyToBoolean(String key, Boolean defaultValue) {
return PropKit.use("play.properties", "UTF-8").getBoolean(key, defaultValue);
}
开发者ID:slashchenxiaojun,项目名称:wall.e,代码行数:4,代码来源:PluginFactory.java
注:本文中的com.jfinal.kit.PropKit类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论