/** * 返回该记录 JSON 格式的字符串表示 * * @return 该记录 JSON 格式的字符串表示 */ public String toString() { return Json.toJson(map, JsonFormat.full()); }
return new UTF8JsonView(JsonFormat.forLook()).setJsonp(VIEW_JSONP.equals(type)); else if ("full".equals(value)) return new UTF8JsonView(JsonFormat.full()).setJsonp(VIEW_JSONP.equals(type)); else if ("compact".equals(value)) return new UTF8JsonView(JsonFormat.compact()).setJsonp(VIEW_JSONP.equals(type));
public NutzJsonEncoder(JsonFormat jf) { this.jf = jf == null ? JsonFormat.full() : jf; }
public NutzJsonEncoder() { this(JsonFormat.full()); }
/** * 返回该记录 JSON 格式的字符串表示 * * @return 该记录 JSON 格式的字符串表示 */ public String toString() { return Json.toJson(map, JsonFormat.full()); }
return new UTF8JsonView(JsonFormat.forLook()).setJsonp(VIEW_JSONP.equals(type)); else if ("full".equals(value)) return new UTF8JsonView(JsonFormat.full()).setJsonp(VIEW_JSONP.equals(type)); else if ("compact".equals(value)) return new UTF8JsonView(JsonFormat.compact()).setJsonp(VIEW_JSONP.equals(type));
public void byWebSocket() { try { if (session == null || !session.isOpen()) { Future<Session> fu = ws.connect(saws, URI.create(conf.get("actuator.uplink.url", "ws://127.0.0.1:8802/monitor/websocket"))); session = fu.get(5, TimeUnit.SECONDS); } NutMap re = monitorService.getMonitors(); session.getRemote().sendString(Json.toJson(re, JsonFormat.full().setCompact(true))); } catch (Throwable e) { log.info("monitor.uplink.error", e); } }
public Object call(Object[] paras, Context ctx) { switch (paras.length) { case 1: return Json.toJson(paras[0], JsonFormat.compact()); case 2: Object t = paras[1]; if (t != null && t instanceof String) { if ("full".equals(t)) { return Json.toJson(paras[0], JsonFormat.full()); } if ("nice".equals(t)) { return Json.toJson(paras[0], JsonFormat.nice()); } if ("compact".equals(t)) { return Json.toJson(paras[0], JsonFormat.compact()); } if ("forLook".equals(t)) { return Json.toJson(paras[0], JsonFormat.forLook()); } if ("tidy".equals(t)) { return Json.toJson(paras[0], JsonFormat.tidy()); } } } throw new BeetlException(BeetlException.FUNCTION_INVALID); }
public Object call(Object[] paras, Context ctx) { switch (paras.length) { case 1: return Json.toJson(paras[0], JsonFormat.compact()); case 2: Object t = paras[1]; if (t != null && t instanceof String) { if ("full".equals(t)) { return Json.toJson(paras[0], JsonFormat.full()); } if ("nice".equals(t)) { return Json.toJson(paras[0], JsonFormat.nice()); } if ("compact".equals(t)) { return Json.toJson(paras[0], JsonFormat.compact()); } if ("forLook".equals(t)) { return Json.toJson(paras[0], JsonFormat.forLook()); } if ("tidy".equals(t)) { return Json.toJson(paras[0], JsonFormat.tidy()); } } } throw new BeetlException(BeetlException.FUNCTION_INVALID); }
break; case "nutzjson": JsonFormat jf = JsonFormat.full(); String jfStr = Strings.sBlank(fc.jsonFormat(), conf.get(PROP_JSON_FORMAT, "")); if (!Strings.isBlank(jfStr)) {
public void byHttp() { NutMap re = monitorService.getMonitors(); String url = conf.get("actuator.uplink.url", "http://127.0.0.1:8802/monitor/uplink"); try { Request req = Request.create(url, METHOD.POST); req.setData(Json.toJson(re, JsonFormat.full())); Response resp = Sender.create(req).send(); if (resp.isOK()) { log.debug("monitor.uplink.success"); } else { log.debug("monitor.uplink.fail=" + resp.getStatus()); } } catch (Throwable e) { log.info("monitor.uplink.error", e); } }