| | |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import java.io.*; |
| | | import java.nio.charset.Charset; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | |
| | | if (inputStream == null) { |
| | | throw new HttpRequestException(RESPONSE_NULL_ERROR_CODE, "响应为null"); |
| | | } |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("GB2312"))); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | String str = ""; |
| | | while ((str = reader.readLine()) != null) { |
| | |
| | | HttpEntity<RESPBODY> rep = null; |
| | | if (isNullOrEmpty(respStr) || null == respBodyClass) { |
| | | rep = new HttpEntity<RESPBODY>(respHeaders, null); |
| | | ;// 无响应 |
| | | // 无响应 |
| | | } else { |
| | | if (respBodyClass != String.class) { |
| | | RESPBODY respBody = JSON.parseObject(respStr, respBodyClass); |
| | | rep = new HttpEntity<RESPBODY>(respHeaders, respBody); |
| | | } else { |
| | | rep = new HttpEntity<RESPBODY>(respHeaders, (RESPBODY) respStr); |
| | | rep = new HttpEntity<RESPBODY>(respHeaders, (RESPBODY) new String(respStr.getBytes("ISO8859-1"), StandardCharsets.UTF_8)); |
| | | } |
| | | } |
| | | return rep; |
| | |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | } |