本文整理了Java中com.weibo.yar.YarResponse.setRet()
方法的一些代码示例,展示了YarResponse.setRet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarResponse.setRet()
方法的具体详情如下:
包路径:com.weibo.yar.YarResponse
类名称:YarResponse
方法名:setRet
暂无
代码示例来源: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;
}
内容来源于网络,如有侵权,请联系作者删除!