当前位置: 首页>>代码示例>>Java>>正文


Java NutMap.put方法代码示例

本文整理汇总了Java中org.nutz.lang.util.NutMap.put方法的典型用法代码示例。如果您正苦于以下问题:Java NutMap.put方法的具体用法?Java NutMap.put怎么用?Java NutMap.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.nutz.lang.util.NutMap的用法示例。


在下文中一共展示了NutMap.put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTemplateShareVars

import org.nutz.lang.util.NutMap; //导入方法依赖的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;
}
 
开发者ID:strictnerd,项目名称:windows-file-change,代码行数:19,代码来源:Toolkit.java

示例2: genJsSDKConfig

import org.nutz.lang.util.NutMap; //导入方法依赖的package包/类
@Override
public NutMap genJsSDKConfig(String url, String... jsApiList) {
	String jt = this.getJsapiTicket();
	long timestamp = System.currentTimeMillis();
	String nonceStr = R.UU64();

	String str = String.format("jsapi_ticket=%s&noncestr=%s&timestamp=%d&url=%s", jt, nonceStr, timestamp, url);
	String signature = Lang.sha1(str);

	NutMap map = new NutMap();
	map.put("appId", appid);
	map.put("timestamp", timestamp);
	map.put("nonceStr", nonceStr);
	map.put("signature", signature);
	map.put("jsApiList", jsApiList);
	return map;
}
 
开发者ID:nutzam,项目名称:nutzwx,代码行数:18,代码来源:AbstractWxApi2.java

示例3: kv2map

import org.nutz.lang.util.NutMap; //导入方法依赖的package包/类
public static NutMap kv2map(String kv) {
	NutMap re = new NutMap();
	if (kv == null || kv.length() == 0 || !kv.contains("="))
		return re;
	String[] tmps = kv.split(",");
	for (String tmp : tmps) {
		if (!tmp.contains("="))
			continue;
		String[] tmps2 = tmp.split("=", 2);
		re.put(tmps2[0], tmps2[1]);
	}
	return re;
}
 
开发者ID:strictnerd,项目名称:windows-file-change,代码行数:14,代码来源:Toolkit.java

示例4: createQR

import org.nutz.lang.util.NutMap; //导入方法依赖的package包/类
@Override
public QRTicket createQR(Object sceneId, int expireSeconds) {
    String url = mergeCgiBinUrl(createQRCodeURL + getAccessToken());
    NutMap data = new NutMap();
    NutMap scene;
    // 临时二维码
    if (expireSeconds > 0) {
        data.put("action_name", "QR_SCENE");
        data.put("expire_seconds", expireSeconds);

        scene = Lang.map("scene_id", Castors.me().castTo(sceneId, Integer.class));
    }
    // 永久二维码
    else if (sceneId instanceof Number) {
        data.put("action_name", "QR_LIMIT_SCENE");
        scene = Lang.map("scene_id", Castors.me().castTo(sceneId, Integer.class));
    }
    // 永久字符串二维码
    else {
        data.put("action_name", "QR_LIMIT_STR_SCENE");
        scene = Lang.map("scene_str", sceneId.toString());
    }
    data.put("action_info", Lang.map("scene", scene));
    APIResult ar = wechatServerResponse(url,
            HTTP_POST,
            Json.toJson(data, JsonFormat.compact()),
            "创建公众号[%s]的[%s]场景二维码失败.");
    return Json.fromJson(QRTicket.class, Json.toJson(ar.getContent()));
}
 
开发者ID:elkan1788,项目名称:mpsdk4j,代码行数:30,代码来源:WechatAPIImpl.java

示例5: resp

import org.nutz.lang.util.NutMap; //导入方法依赖的package包/类
public Object resp(Object ctx, String code, String msg) {
	NutMap map = new NutMap();
	map.put("ok", "true");
	map.put("msg", msg);
	list.add(map);
	return null;
}
 
开发者ID:wendal,项目名称:whale,代码行数:8,代码来源:IotHttpCmdHandler.java

示例6: sendTemplateMsg

import org.nutz.lang.util.NutMap; //导入方法依赖的package包/类
public String sendTemplateMsg(String touser, String template_id, String topcolor, Map<String, WxTemplateData> data) {
    if (Strings.isBlank(topcolor))
        topcolor = WxTemplateData.DFT_COLOR;
    NutMap map = new NutMap();
    map.put("touser", touser);
    map.put("template_id", template_id);
    map.put("topcolor", topcolor);
    map.put("data", data);
    return call("/message/template/send", METHOD.POST, Json.toJson(map)).get("msgid").toString();
}
 
开发者ID:amdiaosi,项目名称:nutzWx,代码行数:11,代码来源:WxApiImpl.java

示例7: qrconnect

import org.nutz.lang.util.NutMap; //导入方法依赖的package包/类
@Override
public String qrconnect(String redirect_uri, String scope, String state) {
    Request req = Request.create("https://open.weixin.qq.com/connect/qrconnect", METHOD.GET);
    NutMap params = new NutMap();
    params.put("appid", appid);
    if (redirect_uri.startsWith("http"))
        params.put("redirect_uri", redirect_uri);
    else
        params.put("redirect_uri", host + redirect_uri);
    params.put("response_type", "code");
    params.put("scope", Strings.sBlank(scope, "snsapi_login"));
    req.setParams(params);
    return req.getUrl().toString() + "#wechat_redirect";
}
 
开发者ID:nutzam,项目名称:nutzwx,代码行数:15,代码来源:WxLoginImpl.java

示例8: authorize

import org.nutz.lang.util.NutMap; //导入方法依赖的package包/类
@Override
public String authorize(String redirect_uri, String scope, String state) {
    Request req = Request.create("https://open.weixin.qq.com/connect/oauth2/authorize", METHOD.GET);
    NutMap params = new NutMap();
    params.put("appid", appid);
    if (redirect_uri.startsWith("http"))
        params.put("redirect_uri", redirect_uri);
    else
        params.put("redirect_uri", host + redirect_uri);
    params.put("response_type", "code");
    params.put("scope", Strings.sBlank(scope, "snsapi_userinfo"));
    req.setParams(params);
    return req.getUrl().toString() + "#wechat_redirect";
}
 
开发者ID:nutzam,项目名称:nutzwx,代码行数:15,代码来源:WxLoginImpl.java

示例9: access_token

import org.nutz.lang.util.NutMap; //导入方法依赖的package包/类
@Override
public WxResp access_token(String code) {
    Request req = Request.create("https://api.weixin.qq.com/sns/oauth2/access_token", METHOD.GET);
    NutMap params = new NutMap();
    params.put("appid", appid);
    params.put("secret", appsecret);
    params.put("code", code);
    params.put("grant_type", "authorization_code");
    req.setParams(params);
    Response resp = Sender.create(req).send();
    if (!resp.isOK()) {
        return null;
    }
    return Json.fromJson(WxResp.class, resp.getReader("UTF-8"));
}
 
开发者ID:nutzam,项目名称:nutzwx,代码行数:16,代码来源:WxLoginImpl.java

示例10: userinfo

import org.nutz.lang.util.NutMap; //导入方法依赖的package包/类
@Override
public WxResp userinfo(String openid, String access_token) {
    // https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID
    Request req = Request.create("https://api.weixin.qq.com/sns/userinfo", METHOD.GET);
    NutMap params = new NutMap();
    params.put("access_token", access_token);
    params.put("openid", openid);
    req.setParams(params);
    Response resp = Sender.create(req).send();
    if (!resp.isOK()) {
        return null;
    }
    return Json.fromJson(WxResp.class, resp.getReader("UTF-8"));
}
 
开发者ID:nutzam,项目名称:nutzwx,代码行数:15,代码来源:WxLoginImpl.java

示例11: postJson

import org.nutz.lang.util.NutMap; //导入方法依赖的package包/类
protected WxResp postJson(String uri, Object... args) {
	NutMap body = new NutMap();
	for (int i = 0; i < args.length; i += 2) {
		body.put(args[i].toString(), args[i + 1]);
	}
	return postJson(uri, body);
}
 
开发者ID:nutzam,项目名称:nutzwx,代码行数:8,代码来源:AbstractWxApi2.java

示例12: sendTemplateMsg

import org.nutz.lang.util.NutMap; //导入方法依赖的package包/类
public String sendTemplateMsg(String touser,
                              String template_id,
                              String topcolor,
                              Map<String, WxTemplateData> data) {
    if (Strings.isBlank(topcolor))
        topcolor = WxTemplateData.DFT_COLOR;
    NutMap map = new NutMap();
    map.put("touser", touser);
    map.put("template_id", template_id);
    map.put("topcolor", topcolor);
    map.put("data", data);
    return call("/message/template/send", METHOD.POST, Json.toJson(map)).get("msgid")
                                                                        .toString();
}
 
开发者ID:nutzam,项目名称:nutzwx,代码行数:15,代码来源:WxApiImpl.java

示例13: mass_sendall

import org.nutz.lang.util.NutMap; //导入方法依赖的package包/类
@Override
public WxResp mass_sendall(boolean is_to_all, String group_id, WxOutMsg msg) {
    NutMap filter = new NutMap();
    filter.put("is_to_all", is_to_all);
    if (!is_to_all) {
        filter.put("group_id", group_id);
    }
    return this._mass_send(filter, null, null, msg);
}
 
开发者ID:nutzam,项目名称:nutzwx,代码行数:10,代码来源:WxApi2Impl.java

示例14: update

import org.nutz.lang.util.NutMap; //导入方法依赖的package包/类
@Override
public WxResp update(int device_id, String comment) {
    NutMap params = new NutMap();
    params.put("device_identifier", new NutMap().setv("device_id", device_id));
    params.put("comment", comment);
    return postJson(ShakeUrlBase + "/device/update", params);
}
 
开发者ID:nutzam,项目名称:nutzwx,代码行数:8,代码来源:WxApi2Impl.java

示例15: createQRTicket

import org.nutz.lang.util.NutMap; //导入方法依赖的package包/类
@Override
public WxResp createQRTicket(long expire, Type type, String str) {
    NutMap json = NutMap.NEW();
    json.put("expire_seconds", expire);
    json.put("action_name", type.getValue());
    NutMap action = NutMap.NEW();
    NutMap scene = NutMap.NEW();
    scene.put("scene_str", str);
    action.put("scene", scene);
    json.put("action_info", action);
    return postJson("/qrcode/create", json);
}
 
开发者ID:nutzam,项目名称:nutzwx,代码行数:13,代码来源:WxApi2Impl.java


注:本文中的org.nutz.lang.util.NutMap.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。