本文整理汇总了Java中org.nutz.ioc.impl.PropertiesProxy类的典型用法代码示例。如果您正苦于以下问题:Java PropertiesProxy类的具体用法?Java PropertiesProxy怎么用?Java PropertiesProxy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertiesProxy类属于org.nutz.ioc.impl包,在下文中一共展示了PropertiesProxy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTemplateShareVars
import org.nutz.ioc.impl.PropertiesProxy; //导入依赖的package包/类
/**
* 模板引擎共用的变量
*/
public static NutMap getTemplateShareVars() {
NutMap share = new NutMap();
Ioc ioc = Mvcs.getIoc();
share.put("ioc", ioc);
PropertiesProxy conf = ioc.get(PropertiesProxy.class, "conf");
share.put("conf", conf.toMap());
if (!conf.getBoolean("cdn.enable", false) || Strings.isBlank(conf.get("cdn.urlbase"))) {
share.put("cdnbase", "");
} else {
share.put("cdnbase", conf.get("cdn.urlbase"));
}
return share;
}
示例2: setPath
import org.nutz.ioc.impl.PropertiesProxy; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public void setPath(String path) {
PropertiesProxy pp = new PropertiesProxy(path);
Map<String, Object> map = new LinkedHashMap(pp.toMap());
if (pp.get("openid") != null) {
String appid = pp.get("openid");
WxMaster def = Lang.map2Object(map, WxMaster.class);
masters.put(appid, def);
apis.put(appid, new WxApiImpl(def));
handlers.put(appid, new BasicWxHandler(def.getToken()));
}
for (Entry<String, Object> en : map.entrySet()) {
String key = en.getKey();
if (key.endsWith(".openid")) {
key = key.substring(0, key.indexOf('.'));
Map<String, Object> tmp = filter(map, key + ".", null, null, null);
String openid = tmp.get("openid").toString();
WxMaster one = Lang.map2Object(tmp, WxMaster.class);
masters.put(openid, one);
apis.put(openid, new WxApiImpl(one));
handlers.put(openid, new BasicWxHandler(one.getToken()));
}
}
}
示例3: test_ioc_load
import org.nutz.ioc.impl.PropertiesProxy; //导入依赖的package包/类
@Test
public void test_ioc_load() throws ClassNotFoundException {
// 仿真一个配置文件
PropertiesProxy conf = new PropertiesProxy();
conf.put("weixin.atstore", "jedis"); // 测试jedisAgent存储AccessToken
conf.put("weixin.token", "1234567890");
conf.put("weixin.appid", "wx10927e35a365fe1c");
conf.put("weixin.appsecret", "c29accd1784e636d6478eac9b6b3aYYY"); // YYY是假的
conf.put("weixin.openid", "XXX");
// 沙箱测试
// http://mp.weixin.qq.com/debug/cgi-bin/sandboxinfo?action=showinfo&t=sandbox/index
NutIoc ioc = new NutIoc(new ComboIocLoader("*weixin", "*jedis"));
ioc.getIocContext().save("app", "conf", new ObjectProxy(conf));
WxApi2 wxApi2 = ioc.get(WxApi2.class);
for (int i = 0; i < 6; i++) {
wxApi2.get_industry();
}
ioc.depose();
}
示例4: start
import org.nutz.ioc.impl.PropertiesProxy; //导入依赖的package包/类
public void start(){
IWsMsgHandler accepter = getIoc().get(IWsMsgHandler.class, "accepter");
PropertiesProxy conf = getIoc().get(PropertiesProxy.class, "conf");
int port = 5210;
port = Integer.valueOf( conf.get("tio.port"));
try {
WsServerStarter wsServerStarter = new WsServerStarter(port, accepter);
groupContext= wsServerStarter.getServerGroupContext();
wsServerStarter.start();
} catch (IOException e) {
e.printStackTrace();
}
}
示例5: configure
import org.nutz.ioc.impl.PropertiesProxy; //导入依赖的package包/类
public WxLoginImpl configure(PropertiesProxy conf, String prefix) {
prefix = Strings.sBlank(prefix);
appid = conf.get(prefix + "appid");
appsecret = conf.get(prefix + "appsecret");
host = conf.get(prefix + "host");
return this;
}
示例6: configure
import org.nutz.ioc.impl.PropertiesProxy; //导入依赖的package包/类
public BasicWxHandler configure(PropertiesProxy conf, String prefix){
prefix = Strings.sBlank(prefix);
token = conf.check(prefix+"token");
aeskey = conf.get(prefix+"aes");
appid = conf.get(prefix+"appid");
return this;
}
示例7: configure
import org.nutz.ioc.impl.PropertiesProxy; //导入依赖的package包/类
public WxApi2 configure(PropertiesProxy conf, String prefix) {
prefix = Strings.sBlank(prefix);
token = conf.check(prefix + "token");
appid = conf.get(prefix + "appid");
appsecret = conf.get(prefix + "appsecret");
openid = conf.get(prefix + "openid");
encodingAesKey = conf.get(prefix + "aes");
return this;
}
示例8: _read_rss
import org.nutz.ioc.impl.PropertiesProxy; //导入依赖的package包/类
private void _read_rss(PropertiesProxy pp) {
String[] ss = Strings.splitIgnoreBlank(pp.get("zdoc-rs"), "[,\n]");
for (String s : ss) {
ZFile d = src.get(s);
if (null != d) {
topIgnores.add(s);
rss.add(d);
}
}
}
示例9: _read_vars
import org.nutz.ioc.impl.PropertiesProxy; //导入依赖的package包/类
private void _read_vars(PropertiesProxy pp) {
String[] ss = Strings.splitIgnoreBlank(pp.get("zdoc-vars"), "\n");
for (String s : ss) {
int pos = s.indexOf('=');
String varName = s.substring(0, pos).trim();
String valValue = s.substring(pos + 1).trim();
vars.set(varName, valValue);
}
}
示例10: _read_rules
import org.nutz.ioc.impl.PropertiesProxy; //导入依赖的package包/类
private void _read_rules(PropertiesProxy pp) {
String[] ss = Strings.splitIgnoreBlank(pp.get("zdoc-rules"), "\n");
for (String s : ss) {
int pos = s.lastIndexOf(':');
String regex = s.substring(0, pos).trim();
String key = s.substring(pos + 1).trim();
ZDocRule rule = new ZDocRule();
rules.add(rule.key(key).regex(regex));
}
}
示例11: switchTo
import org.nutz.ioc.impl.PropertiesProxy; //导入依赖的package包/类
@Override
public void switchTo(ZDir home) {
this.home = home;
this.conf = new ZPageConfig();
// 看看有木有特殊的配置信息
ZFile zf = home.get("zpage.conf");
if (null != zf) {
PropertiesProxy pp = new PropertiesProxy(io.readString(zf));
conf.tmpl(pp.trim("zpage-tmpl", conf.tmpl()));
conf.libs(pp.trim("zpage-libs", conf.libs()));
conf.rs(Strings.splitIgnoreBlank(pp.trim("zpage-rs", "imgs,js,css")));
String rules = pp.get("zpage-rules", " .* : normal");
String[] lines = Strings.splitIgnoreBlank(rules, "\n");
List<ZPageRule> list = new ArrayList<ZPageRule>(lines.length);
for (String line : lines) {
int pos = line.lastIndexOf(':');
ZPageRule rule = new ZPageRule(Strings.trim(line.substring(0,
pos)),
Strings.trim(line.substring(pos + 1)));
list.add(rule);
}
}
}
示例12: getProject
import org.nutz.ioc.impl.PropertiesProxy; //导入依赖的package包/类
/**
* @return the project
*/
public static PropertiesProxy getProject() {
return project;
}
示例13: getTemplete
import org.nutz.ioc.impl.PropertiesProxy; //导入依赖的package包/类
/**
* @return the templete
*/
public static PropertiesProxy getTemplete() {
return templete;
}
示例14: getTypeMapping
import org.nutz.ioc.impl.PropertiesProxy; //导入依赖的package包/类
/**
* @return the typeMapping
*/
public static PropertiesProxy getTypeMapping() {
return typeMapping;
}
示例15: getTableMapping
import org.nutz.ioc.impl.PropertiesProxy; //导入依赖的package包/类
/**
* @return the tableMapping
*/
public static PropertiesProxy getTableMapping() {
return tableMapping;
}