|
@@ -8,6 +8,7 @@ import java.util.Date;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.http.Header;
|
|
import org.apache.http.Header;
|
|
import org.apache.http.HttpEntity;
|
|
import org.apache.http.HttpEntity;
|
|
import org.apache.http.HttpResponse;
|
|
import org.apache.http.HttpResponse;
|
|
@@ -141,22 +142,26 @@ public class HttpClientUtil {
|
|
}
|
|
}
|
|
|
|
|
|
public synchronized String post(String url, String content) throws Exception {
|
|
public synchronized String post(String url, String content) throws Exception {
|
|
- String result = post(url, content, 300000, null,null);
|
|
|
|
|
|
+ String result = post(url, content, 300000, null,null,null);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
public synchronized String post(String url, String content,HttpServletResponse response) throws Exception {
|
|
public synchronized String post(String url, String content,HttpServletResponse response) throws Exception {
|
|
- String result = post(url, content, 300000, null,response);
|
|
|
|
|
|
+ String result = post(url, content, 300000, null,response,null);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- public synchronized String post(String url, String content, Integer timeout, Map<String, String> headerMap,HttpServletResponse response) throws Exception {
|
|
|
|
|
|
+ public synchronized String post(String url, String content, Integer timeout, Map<String, String> headerMap,HttpServletResponse response, HttpServletResponse request) throws Exception {
|
|
if (Constant.http_interval > 0) {
|
|
if (Constant.http_interval > 0) {
|
|
Thread.sleep(Constant.http_interval);
|
|
Thread.sleep(Constant.http_interval);
|
|
}
|
|
}
|
|
|
|
|
|
HttpPost httpost = new HttpPost(url);
|
|
HttpPost httpost = new HttpPost(url);
|
|
|
|
+ if(!url.contains("login")||!url.contains("getCaptchaBase64"))
|
|
|
|
+ {
|
|
|
|
+ httpost.setHeader("Authorization", request.getHeader("Authorization"));
|
|
|
|
+ }
|
|
if (headerMap != null) {
|
|
if (headerMap != null) {
|
|
for (String key : headerMap.keySet()) {
|
|
for (String key : headerMap.keySet()) {
|
|
httpost.setHeader(key, headerMap.get(key));
|
|
httpost.setHeader(key, headerMap.get(key));
|
|
@@ -176,7 +181,7 @@ public class HttpClientUtil {
|
|
HttpResponse httpResponse = client.execute(httpost);
|
|
HttpResponse httpResponse = client.execute(httpost);
|
|
if(url.contains("login"))
|
|
if(url.contains("login"))
|
|
{
|
|
{
|
|
- Header responseFirstHeader= httpResponse.getFirstHeader("app-token");
|
|
|
|
|
|
+ Header responseFirstHeader= httpResponse.getFirstHeader("Authorization");
|
|
response.setHeader(responseFirstHeader.getName(),responseFirstHeader.getValue());
|
|
response.setHeader(responseFirstHeader.getName(),responseFirstHeader.getValue());
|
|
}
|
|
}
|
|
InputStream is = httpResponse.getEntity().getContent();
|
|
InputStream is = httpResponse.getEntity().getContent();
|