本文整理汇总了Java中org.nutz.lang.util.NutMap.getString方法的典型用法代码示例。如果您正苦于以下问题:Java NutMap.getString方法的具体用法?Java NutMap.getString怎么用?Java NutMap.getString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.nutz.lang.util.NutMap
的用法示例。
在下文中一共展示了NutMap.getString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reflushJsapiTicket
import org.nutz.lang.util.NutMap; //导入方法依赖的package包/类
protected void reflushJsapiTicket() {
String at = this.getAccessToken();
String url = String.format("%s/ticket/getticket?access_token=%s&type=jsapi", base, at);
if (log.isDebugEnabled())
log.debugf("ATS: reflush jsapi ticket send: %s", url);
Response resp = Http.get(url);
if (!resp.isOK())
throw new IllegalArgumentException("reflushJsapiTicket FAIL , openid=" + openid);
String str = resp.getContent();
if (log.isDebugEnabled())
log.debugf("ATS: reflush jsapi ticket done: %s", str);
NutMap re = Json.fromJson(NutMap.class, str);
String ticket = re.getString("ticket");
int expires = re.getInt("expires_in") - 200;//微信默认超时为7200秒,此处设置稍微短一点
jsapiTicketStore.save(ticket, expires, System.currentTimeMillis());
}
示例2: reflushAccessToken
import org.nutz.lang.util.NutMap; //导入方法依赖的package包/类
protected synchronized void reflushAccessToken() {
String url = String.format("%s/token?grant_type=client_credential&appid=%s&secret=%s", base, appid, appsecret);
if (log.isDebugEnabled())
log.debugf("ATS: reflush access_token send: %s", url);
Response resp = Http.get(url);
if (!resp.isOK())
throw new IllegalArgumentException("reflushAccessToken FAIL , openid=" + openid);
String str = resp.getContent();
if (log.isDebugEnabled())
log.debugf("ATS: reflush access_token done: %s", str);
NutMap re = Json.fromJson(NutMap.class, str);
String token = re.getString("access_token");
int expires = re.getInt("expires_in") - 200;//微信默认超时为7200秒,此处设置稍微短一点
accessTokenStore.save(token, expires, System.currentTimeMillis());
}
示例3: passwdResetCallback
import org.nutz.lang.util.NutMap; //导入方法依赖的package包/类
@At("/pwd_reset/callback/?")
@Ok("jsp:jsp.usr.pwdreset.done")
public boolean passwdResetCallback(String token) {
if (Strings.isBlank(token)) {
throw new IllegalArgumentException("bad token=["+token+"]");
}
String re = Toolkit._3DES_decode(pwdResetKey, Toolkit.hexstr2bytearray(token));
if (re == null) {
throw new IllegalArgumentException("bad token=["+token+"]");
}
NutMap map = Toolkit.kv2map(re);
if (map.getLong("t") - 30*60*1000 > System.currentTimeMillis()) {
throw new IllegalArgumentException("bad token=["+token+"] timeout");
}
String name = map.getString("u");
User usr = dao.fetch(User.class, name);
if (usr == null) {
throw new IllegalArgumentException("bad token=["+token+"]");
}
if (!usr.getSlat().equals(map.getString("slat"))) {
throw new IllegalArgumentException("bad token=["+token+"]");
}
// 看来都是正确的,那允许重置密码了
String pwd = Toolkit.randomPasswd(usr);
dao.update(usr, "(slat|passwd)"); // 重置slat,这样token就是一次性咯
// TODO 记入系统操作日志
log.info("AdminUser Password reset success >> " + name);
return mailService.send(usr.getEmail(), "New Password", "Password: ${pwd}", Lang.context().set("pwd", pwd));
}