Search in sources :

Example 26 with UAVHttpMessage

use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.

the class InvokeChainQueryServerWorker method adaptRequest.

@Override
protected UAVHttpMessage adaptRequest(HttpMessage message) {
    String messageBody = message.getRequestBodyAsString("UTF-8");
    if (log.isDebugEnable()) {
        log.debug(this, "InvokeChainQueryServerWorker Request: " + messageBody);
    }
    UAVHttpMessage msg = new UAVHttpMessage(messageBody);
    return msg;
}
Also used : UAVHttpMessage(com.creditease.agent.http.api.UAVHttpMessage)

Example 27 with UAVHttpMessage

use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.

the class MDFListenServer method adaptRequest.

@Override
protected UAVHttpMessage adaptRequest(HttpMessage message) {
    String messageBody = message.getRequestBodyAsString("UTF-8");
    if (log.isDebugEnable()) {
        log.debug(this, "MDFListenServer Request: " + messageBody);
    }
    UAVHttpMessage msg = new UAVHttpMessage();
    msg.putRequest(UAVHttpMessage.BODY, messageBody);
    return msg;
}
Also used : UAVHttpMessage(com.creditease.agent.http.api.UAVHttpMessage)

Example 28 with UAVHttpMessage

use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.

the class NotificaitonScheduleWorker method executeNCHttpTestcase.

public void executeNCHttpTestcase() {
    String url = "http://localhost:8766/nc/update";
    UAVHttpMessage request = new UAVHttpMessage();
    String nceventKey = "127.0.0.1@notificationEvent@NotificaitonScheduleWorker@notifytestagent@-1172353146";
    request.putRequest("ncevent", nceventKey);
    String content = JSONHelper.toString(request);
    executeHttpCommand(url, content);
}
Also used : UAVHttpMessage(com.creditease.agent.http.api.UAVHttpMessage)

Example 29 with UAVHttpMessage

use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.

the class LogNodeOperAction method doAction.

@Override
public void doAction(ActionContext context) throws Exception {
    AgentFeatureComponent afc = (AgentFeatureComponent) getConfigManager().getComponent(feature, "LogAgent");
    if (afc == null) {
        return;
    }
    UAVHttpMessage data = (UAVHttpMessage) context.getParam("msg");
    String strategy = data.getRequest("strategy");
    try {
        afc.exchange("logagent.strategy", strategy);
        data.putResponse("rs", "OK");
    } catch (Exception e) {
        log.err(this, "exchange logagent strategy FAILED. " + strategy, e);
        data.putResponse("rs", "ERR");
        data.putResponse("msg", "设置日志抓取策略出错!");
    }
}
Also used : UAVHttpMessage(com.creditease.agent.http.api.UAVHttpMessage) AgentFeatureComponent(com.creditease.agent.spi.AgentFeatureComponent)

Example 30 with UAVHttpMessage

use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.

the class HttpTestApphubManager method getRequestData.

// tools---------------------------------------------------》
/**
 * 打包请求数据
 *
 * @param type
 * @param paramPath
 * @return
 */
private static byte[] getRequestData(bussinessType type, String paramPath) {
    Map<String, String> dbInfo = getDBInfo(type);
    UAVHttpMessage request = new UAVHttpMessage();
    String dataStr = getFileData(paramPath);
    request.putRequest(DataStoreProtocol.MONGO_REQUEST_DATA, dataStr);
    request.putRequest(DataStoreProtocol.DATASTORE_NAME, dbInfo.get(k_dataStoreName));
    request.putRequest(DataStoreProtocol.MONGO_COLLECTION_NAME, dbInfo.get(k_conllectionName));
    String jsonStr = JSONHelper.toString(request);
    byte[] datab = null;
    try {
        datab = jsonStr.getBytes("utf-8");
    } catch (UnsupportedEncodingException e) {
        LOG.info("HttpTestApphub getRequestData \n" + e.getMessage());
    }
    return datab;
}
Also used : UnsupportedEncodingException(java.io.UnsupportedEncodingException) UAVHttpMessage(com.creditease.agent.http.api.UAVHttpMessage)

Aggregations

UAVHttpMessage (com.creditease.agent.http.api.UAVHttpMessage)58 Path (javax.ws.rs.Path)25 Produces (javax.ws.rs.Produces)25 POST (javax.ws.rs.POST)22 HashMap (java.util.HashMap)14 HttpClientCallback (com.creditease.uav.httpasync.HttpClientCallback)5 HttpClientCallbackResult (com.creditease.uav.httpasync.HttpClientCallbackResult)5 ArrayList (java.util.ArrayList)5 List (java.util.List)5 ApphubException (com.creditease.uav.exception.ApphubException)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 LinkedHashMap (java.util.LinkedHashMap)4 Map (java.util.Map)4 IOException (java.io.IOException)3 SimpleDateFormat (java.text.SimpleDateFormat)3 GET (javax.ws.rs.GET)3 AbstractSystemInvoker (com.creditease.agent.spi.AbstractSystemInvoker)2 AgentFeatureComponent (com.creditease.agent.spi.AgentFeatureComponent)2 BASE64DecoderUrl (com.creditease.uav.helpers.url.BASE64DecoderUrl)2 Date (java.util.Date)2