Commit 0c3ce853 authored by yanzg's avatar yanzg

修复bug

parent 2299e56e
...@@ -22,11 +22,11 @@ public class HttpHelper { ...@@ -22,11 +22,11 @@ public class HttpHelper {
/** /**
* 链接超时 * 链接超时
*/ */
public static int HTTP_CONNECT_TIMEOUT = 10 * 1000; public static int HTTP_CONNECT_TIMEOUT = 3 * 1000;
/** /**
* 读取超时 * 读取超时
*/ */
public static int HTTP_READ_TIMEOUT = 30 * 1000; public static int HTTP_READ_TIMEOUT = 15 * 1000;
/** /**
* 字符编码 * 字符编码
*/ */
...@@ -46,7 +46,7 @@ public class HttpHelper { ...@@ -46,7 +46,7 @@ public class HttpHelper {
* 获取请求参数 * 获取请求参数
* *
* @param obj 对象 * @param obj 对象
* @return * @return 请求参数字符串
*/ */
public static String getUrlParameter(Object obj, String charset) { public static String getUrlParameter(Object obj, String charset) {
MapRow to = JsonHelper.to(obj, MapRow.class); MapRow to = JsonHelper.to(obj, MapRow.class);
...@@ -66,8 +66,8 @@ public class HttpHelper { ...@@ -66,8 +66,8 @@ public class HttpHelper {
* 获取连接 * 获取连接
* *
* @param url 请求地址 * @param url 请求地址
* @return * @return 链接
* @throws IOException * @throws IOException 抛出的异常信息
*/ */
public static HttpURLConnection getConn(String url) throws IOException { public static HttpURLConnection getConn(String url) throws IOException {
return getConn(url, null, false); return getConn(url, null, false);
...@@ -78,8 +78,8 @@ public class HttpHelper { ...@@ -78,8 +78,8 @@ public class HttpHelper {
* *
* @param url 请求地址 * @param url 请求地址
* @param header 请求头 * @param header 请求头
* @return * @return 链接
* @throws IOException * @throws IOException 抛出的异常信息
*/ */
public static HttpURLConnection getConn(String url, Map<String, String> header) throws IOException { public static HttpURLConnection getConn(String url, Map<String, String> header) throws IOException {
return getConn(url, header, false); return getConn(url, header, false);
...@@ -90,8 +90,8 @@ public class HttpHelper { ...@@ -90,8 +90,8 @@ public class HttpHelper {
* *
* @param url 请求地址 * @param url 请求地址
* @param isApplicationJson 是否请求json * @param isApplicationJson 是否请求json
* @return * @return 链接
* @throws IOException * @throws IOException 抛出的异常信息
*/ */
public static HttpURLConnection getConn(String url, boolean isApplicationJson) throws IOException { public static HttpURLConnection getConn(String url, boolean isApplicationJson) throws IOException {
return getConn(url, null, isApplicationJson); return getConn(url, null, isApplicationJson);
...@@ -103,8 +103,8 @@ public class HttpHelper { ...@@ -103,8 +103,8 @@ public class HttpHelper {
* @param url 请求地址 * @param url 请求地址
* @param header 请求头 * @param header 请求头
* @param isApplicationJson 是否请求json * @param isApplicationJson 是否请求json
* @return * @return 链接
* @throws IOException * @throws IOException 抛出的异常信息
*/ */
public static HttpURLConnection getConn(String url, Map<String, String> header, boolean isApplicationJson) throws IOException { public static HttpURLConnection getConn(String url, Map<String, String> header, boolean isApplicationJson) throws IOException {
// 创建URL对象 // 创建URL对象
...@@ -289,10 +289,11 @@ public class HttpHelper { ...@@ -289,10 +289,11 @@ public class HttpHelper {
/** /**
* 读取数据流 * 读取数据流
* *
* @param stream * @param stream 流
* @param result * @param result 结果字符串
* @return * @param charset 编码方式
* @throws IOException * @return 读取的缓存流
* @throws IOException IO异常
*/ */
private static BufferedReader readStream(InputStream stream, StringBuilder result, String charset) throws IOException { private static BufferedReader readStream(InputStream stream, StringBuilder result, String charset) throws IOException {
if (stream == null) { if (stream == null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment