号簿助手 v4.6.31版本的 MD5 值为:9d7ff98a6bb5cc178eac2df4d1b2f0e0
以下内容为反编译后的 DefaultAppRecomdManager.java 源代码,内容仅作参考
package com.chinatelecom.pim.core.manager.impl;
import com.chinatelecom.pim.core.manager.AppRecomdManager;
import com.chinatelecom.pim.foundation.lang.log.Log;
import com.chinatelecom.pim.foundation.lang.model.plugin.AppRecomdRequest;
import com.chinatelecom.pim.foundation.lang.model.plugin.AppRecomdResponse;
import com.chinatelecom.pim.foundation.lang.utils.StringUtils;
import com.google.gson.Gson;
import java.io.IOException;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
public class DefaultAppRecomdManager extends BaseManager implements AppRecomdManager {
private static final Log logger = Log.build(DefaultAddressBookManager.class);
private Gson gson = new Gson();
@Override
public AppRecomdResponse getAppRecomd(AppRecomdRequest request) {
AppRecomdResponse appRecomdResponse = null;
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("http://pim.server.xiaobz.com:9090/sdk/market");
httpPost.addHeader("Accept", "application/json");
httpPost.addHeader(HTTP.CONTENT_TYPE, "application/json");
String respContent = null;
try {
String s = this.gson.toJson(request);
httpPost.setEntity(new StringEntity(s));
HttpResponse httpResponse = httpClient.execute(httpPost);
if (httpResponse.getStatusLine().getStatusCode() == 200) {
respContent = EntityUtils.toString(httpResponse.getEntity());
} else if (httpResponse.getStatusLine().getStatusCode() == 500) {
}
if (!StringUtils.isNotBlank(respContent)) {
return null;
}
appRecomdResponse = (AppRecomdResponse) this.gson.fromJson(respContent, AppRecomdResponse.class);
return appRecomdResponse;
} catch (IOException e) {
e.printStackTrace();
return appRecomdResponse;
}
}
}