feat:proxy error
This commit is contained in:
parent
a1ca5b9cfc
commit
d0ee190726
@ -7,6 +7,8 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ensign.crm.module.crm.exception.AllKingdeeException;
|
import com.ensign.crm.module.crm.exception.AllKingdeeException;
|
||||||
import com.ensign.crm.module.crm.model.ImageStorage;
|
import com.ensign.crm.module.crm.model.ImageStorage;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.http.Header;
|
import org.apache.http.Header;
|
||||||
import org.apache.http.HttpEntity;
|
import org.apache.http.HttpEntity;
|
||||||
@ -42,6 +44,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@ -137,10 +140,16 @@ public class ProxyService {
|
|||||||
delegate.getHeaders().add("access_token", accessToken);
|
delegate.getHeaders().add("access_token", accessToken);
|
||||||
}
|
}
|
||||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||||
|
int contentLength = request.getContentLength();
|
||||||
byte[] buffer = new byte[4096];
|
byte[] buffer = new byte[4096];
|
||||||
int bytesRead;
|
int bytesRead;
|
||||||
|
int hasRead = 0;
|
||||||
while ((bytesRead = request.getInputStream().read(buffer)) != -1) {
|
while ((bytesRead = request.getInputStream().read(buffer)) != -1) {
|
||||||
byteArrayOutputStream.write(buffer, 0, bytesRead);
|
byteArrayOutputStream.write(buffer, 0, bytesRead);
|
||||||
|
hasRead += bytesRead;
|
||||||
|
if (hasRead == contentLength) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
byte[] bytes = byteArrayOutputStream.toByteArray();
|
byte[] bytes = byteArrayOutputStream.toByteArray();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user