gpt4 book ai didi

com.weibo.yar.YarResponse.setPackagerName()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 17:56:31 26 4
gpt4 key购买 nike

本文整理了Java中com.weibo.yar.YarResponse.setPackagerName()方法的一些代码示例,展示了YarResponse.setPackagerName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarResponse.setPackagerName()方法的具体详情如下:
包路径:com.weibo.yar.YarResponse
类名称:YarResponse
方法名:setPackagerName

YarResponse.setPackagerName介绍

暂无

代码示例

代码示例来源:origin: weibocom/motan

public static YarResponse buildDefaultErrorResponse(String errMsg, String packagerName) {
  YarResponse yarResponse = new YarResponse();
  yarResponse.setPackagerName(packagerName);
  yarResponse.setError(errMsg);
  yarResponse.setStatus("500");
  return yarResponse;
}

代码示例来源:origin: weibocom/motan

public static YarResponse convert(Response response, String packagerName) {
  YarResponse yarResponse = new YarResponse();
  yarResponse.setId(response.getRequestId());
  yarResponse.setPackagerName(packagerName);
  if (response.getException() != null) {
    if (response.getException() instanceof MotanBizException) {
      yarResponse.setError(response.getException().getCause().getMessage());
    } else {
      yarResponse.setError(response.getException().getMessage());
    }
  } else {
    yarResponse.setRet(response.getValue());
  }
  return yarResponse;
}

代码示例来源:origin: com.weibo/yar-java

private YarResponse process(YarRequest request) {
  YarResponse response = new YarResponse();
  response.setId(request.getId());
  response.setPackagerName(request.getPackagerName());
  JSONObject jo = new JSONObject();
  jo.put("key", "test");
  response.setRet(jo);
  return response;
}

代码示例来源:origin: com.weibo/yar-java

@SuppressWarnings("rawtypes")
public static YarResponse buildResponse(byte[] responseBytes) throws IOException {
  if (responseBytes == null) {
    throw new YarException("response bytes is null");
  }
  Map contentMap = fetchContent(responseBytes);
  YarResponse response = new YarResponse();
  response.setPackagerName((String) contentMap.get("ext-packagerName"));
  if (contentMap.containsKey("i")) {
    response.setId(((Number) contentMap.get("i")).longValue());
  }
  if (contentMap.containsKey("s")) {
    response.setStatus(contentMap.get("s").toString());
  }
  if (contentMap.containsKey("o")) {
    response.setOutput(contentMap.get("o"));
  }
  if (contentMap.containsKey("e")) {
    response.setError(contentMap.get("e").toString());
  }
  if (contentMap.containsKey("r")) {
    response.setRet(contentMap.get("r"));
  }
  return response;
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com