use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class GUIService method createAppInfoCache.
private void createAppInfoCache() {
Map<String, Object> where = new HashMap<String, Object>();
where.put("state", 1);
Map<String, Object> data = new HashMap<String, Object>();
data.put("where", where);
String dataStr = JSONHelper.toString(data);
Map<String, Object> jsonRequest = new HashMap<String, Object>();
jsonRequest.put("type", "query");
jsonRequest.put("data", dataStr);
HashMap<String, String> dbInfo = new HashMap<String, String>();
dbInfo.put("dataStoreName", "AppHub.app");
dbInfo.put("conllectionName", "uav_appinfo");
UAVHttpMessage request = new UAVHttpMessage();
request.putRequest("mrd.data", JSONHelper.toString(jsonRequest));
request.putRequest("datastore.name", dbInfo.get("dataStoreName"));
request.putRequest("mgo.coll.name", dbInfo.get("conllectionName"));
String jsonStr = JSONHelper.toString(request);
byte[] datab = null;
try {
datab = jsonStr.getBytes("utf-8");
} catch (Exception e) {
logger.err(this, "GUIService createAppInfoCache \n" + e.getMessage());
throw new ApphubException(e);
}
logger.info(this, "GUIService createAppInfoCache");
AppCacheCallBack appCacheCb = new AppCacheCallBack();
doHttpPost("uav.app.manage.apphubmanager.http.addr", "/ah/app", datab, "application/json", "utf-8", appCacheCb);
}
use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class APMRestService method queryIVC.
@POST
@Path("ivc/q")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void queryIVC(String data, @Suspended AsyncResponse response) {
UAVHttpMessage msg = new UAVHttpMessage(data);
this.doHttpPost("uav.app.apm.ivc.http.addr", "/ivc/q", msg, new IVCCallback(response));
}
use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class GodEyeRestService method loadAppProfileDetail.
/**
* 读取profile的某个lazy模式加载的数据
*
* @param data
* @param response
*/
@POST
@Path("profile/q/detail")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void loadAppProfileDetail(String data, @Suspended AsyncResponse response) {
UAVHttpMessage message = new UAVHttpMessage(data);
loadAppProfileListFromHttp(message, response);
}
use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class GodEyeRestService method noitifyView.
@POST
@Path("notify/view/hm")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void noitifyView(String data, @Suspended AsyncResponse response) throws Exception {
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
@SuppressWarnings("unchecked") Map<String, String> jsonParam = JSONHelper.toObject(data, Map.class);
String url = jsonParam.get("url");
String time;
if ("link".equals(jsonParam.get("type"))) {
byte[] d = new BASE64DecoderUrl().decodeBuffer(url);
url = new String(d, "utf-8");
time = url.substring(url.lastIndexOf("&") + 1);
} else {
String timeStr = url.substring(url.lastIndexOf("&") + 1);
time = String.valueOf(simpleDateFormat.parse(timeStr).getTime());
}
String ntfkey = url.substring(0, url.lastIndexOf("&"));
String loginUser = "";
HttpSession session = request.getSession(false);
if (null != session) {
loginUser = String.valueOf(session.getAttribute("apphub.gui.session.login.user.id"));
}
String log = "loginUser=[" + loginUser + "],type=[" + jsonParam.get("type") + "],ntfkey=[" + ntfkey + "],time=[" + time + "]";
if (!"".equals(ntfkey) && !"undefined".equals(ntfkey)) {
UAVHttpMessage message = new UAVHttpMessage();
message.putRequest("ncevent", ntfkey);
message.putRequest("time", time);
NoitifyViewCB callback = new NoitifyViewCB();
callback.setResponse(response);
callback.setLog(log);
doHttpPost("uav.app.godeye.notify.view.http.addr", "/nc/update", message, callback);
}
}
use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class GodEyeRestService method loadMonitorDataFromOpenTSDB.
private void loadMonitorDataFromOpenTSDB(String data, final AsyncResponse response) {
UAVHttpMessage message = new UAVHttpMessage();
message.putRequest("opentsdb.query.json", data);
message.putRequest("datastore.name", MonitorDataFrame.MessageType.Monitor.toString());
LoadMonitorDataFromOpenTSDBCB callback = new LoadMonitorDataFromOpenTSDBCB();
callback.setResponse(response);
this.doHttpPost("uav.app.godeye.healthmanager.http.addr", "/hm/query", message, callback);
}
Aggregations