|
@@ -1,11 +1,9 @@
|
|
|
package com.core.net.http;
|
|
package com.core.net.http;
|
|
|
|
|
|
|
|
-import android.util.Log;
|
|
|
|
|
-
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.common.LogUtil;
|
|
import com.common.LogUtil;
|
|
|
import com.common.data.StringUtil;
|
|
import com.common.data.StringUtil;
|
|
|
import com.common.hmac.HmacUtils;
|
|
import com.common.hmac.HmacUtils;
|
|
|
-import com.common.preferences.PreferenceUtils;
|
|
|
|
|
import com.core.api.wxapi.ApiConfig;
|
|
import com.core.api.wxapi.ApiConfig;
|
|
|
import com.core.api.wxapi.ApiUtils;
|
|
import com.core.api.wxapi.ApiUtils;
|
|
|
import com.core.app.Constants;
|
|
import com.core.app.Constants;
|
|
@@ -122,7 +120,6 @@ public class HttpClient {
|
|
|
|
|
|
|
|
public String sendPostRequest(String url, Map<String, String> params)
|
|
public String sendPostRequest(String url, Map<String, String> params)
|
|
|
throws IOException {
|
|
throws IOException {
|
|
|
- Log.i("HTTP", "post url=" + url);
|
|
|
|
|
String result = null;
|
|
String result = null;
|
|
|
HttpResponse response = null;
|
|
HttpResponse response = null;
|
|
|
DefaultHttpClient httpclient = MyHttpClient.getNewHttpClient();
|
|
DefaultHttpClient httpclient = MyHttpClient.getNewHttpClient();
|
|
@@ -162,6 +159,7 @@ public class HttpClient {
|
|
|
String temp = EntityUtils.toString(response.getEntity());
|
|
String temp = EntityUtils.toString(response.getEntity());
|
|
|
if ("b2b".equals(params.get("appId"))) {
|
|
if ("b2b".equals(params.get("appId"))) {
|
|
|
Header[] headers = response.getHeaders("Set-Cookie");
|
|
Header[] headers = response.getHeaders("Set-Cookie");
|
|
|
|
|
+ LogUtil.d("AppLogin", "B2B 登录接口响应头:"+JSON.toJSONString(headers));
|
|
|
if (headers != null && headers.length > 0) {
|
|
if (headers != null && headers.length > 0) {
|
|
|
for (Header header : headers) {
|
|
for (Header header : headers) {
|
|
|
String value = header.getValue();
|
|
String value = header.getValue();
|
|
@@ -188,7 +186,7 @@ public class HttpClient {
|
|
|
try {
|
|
try {
|
|
|
if (url.contains(ApiConfig.getInstance(ApiUtils.getApiModel()).getmApiBase().login)) {
|
|
if (url.contains(ApiConfig.getInstance(ApiUtils.getApiModel()).getmApiBase().login)) {
|
|
|
String b2bCookie = response.getHeaders("Set-Cookie")[0].getValue() + ";" + response.getHeaders("Set-Cookie")[1].getValue();
|
|
String b2bCookie = response.getHeaders("Set-Cookie")[0].getValue() + ";" + response.getHeaders("Set-Cookie")[1].getValue();
|
|
|
- LogUtil.d("HttpClient", "B2B Cookie:" + b2bCookie);
|
|
|
|
|
|
|
+ LogUtil.d("AppLogin", "B2B Cookie:" + b2bCookie);
|
|
|
ApiConfig.getInstance(ApiUtils.getApiModel()).getmApiBase().setCookie(b2bCookie);
|
|
ApiConfig.getInstance(ApiUtils.getApiModel()).getmApiBase().setCookie(b2bCookie);
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -198,11 +196,11 @@ public class HttpClient {
|
|
|
for (int i = 0; i < cookieStore.getCookies().size(); i++) {
|
|
for (int i = 0; i < cookieStore.getCookies().size(); i++) {
|
|
|
if ("218.17.158.219".equals(cookieStore.getCookies().get(i)
|
|
if ("218.17.158.219".equals(cookieStore.getCookies().get(i)
|
|
|
.getDomain())) {
|
|
.getDomain())) {
|
|
|
- PreferenceUtils.putLong(MyApplication.getInstance(), "WebViewCommActivity_time", System.currentTimeMillis());
|
|
|
|
|
|
|
+// PreferenceUtils.putLong(MyApplication.getInstance(), "WebViewCommActivity_time", System.currentTimeMillis());
|
|
|
MyApplication.cookieERP = cookieStore.getCookies().get(i);
|
|
MyApplication.cookieERP = cookieStore.getCookies().get(i);
|
|
|
} else {
|
|
} else {
|
|
|
MyApplication.cookieERP = cookieStore.getCookies().get(i);
|
|
MyApplication.cookieERP = cookieStore.getCookies().get(i);
|
|
|
- PreferenceUtils.putLong(MyApplication.getInstance(), "WebViewCommActivity_time", System.currentTimeMillis());
|
|
|
|
|
|
|
+// PreferenceUtils.putLong(MyApplication.getInstance(), "WebViewCommActivity_time", System.currentTimeMillis());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|