|
@@ -8,7 +8,7 @@ import java.io.OutputStream;
|
|
import java.net.HttpURLConnection;
|
|
import java.net.HttpURLConnection;
|
|
import java.net.MalformedURLException;
|
|
import java.net.MalformedURLException;
|
|
import java.net.URL;
|
|
import java.net.URL;
|
|
-
|
|
|
|
|
|
+import nc.log.NcLog;
|
|
|
|
|
|
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
|
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
|
//import net.sf.json.JSONObject;
|
|
//import net.sf.json.JSONObject;
|
|
@@ -48,9 +48,9 @@ public class HttpHelper {
|
|
//设置请求方法
|
|
//设置请求方法
|
|
connection.setRequestMethod("POST");
|
|
connection.setRequestMethod("POST");
|
|
//设置连接超时时间
|
|
//设置连接超时时间
|
|
- connection.setConnectTimeout(30000);
|
|
|
|
|
|
+ connection.setConnectTimeout(60000);
|
|
//设置读取超时时间
|
|
//设置读取超时时间
|
|
- connection.setReadTimeout(30000);
|
|
|
|
|
|
+ connection.setReadTimeout(60000);
|
|
//DoOutput设置是否向httpUrlConnection输出,DoInput设置是否从httpUrlConnection读入,此外发送post请求必须设置这两个
|
|
//DoOutput设置是否向httpUrlConnection输出,DoInput设置是否从httpUrlConnection读入,此外发送post请求必须设置这两个
|
|
//设置是否可读取
|
|
//设置是否可读取
|
|
connection.setDoOutput(true);
|
|
connection.setDoOutput(true);
|
|
@@ -87,8 +87,10 @@ public class HttpHelper {
|
|
}
|
|
}
|
|
|
|
|
|
} catch (MalformedURLException e) {
|
|
} catch (MalformedURLException e) {
|
|
|
|
+ NcLog.info(e.getMessage());
|
|
ExceptionUtils.wrappBusinessException(e.getMessage());
|
|
ExceptionUtils.wrappBusinessException(e.getMessage());
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
|
|
+ NcLog.info(e.getMessage());
|
|
ExceptionUtils.wrappBusinessException(e.getMessage());
|
|
ExceptionUtils.wrappBusinessException(e.getMessage());
|
|
} finally {
|
|
} finally {
|
|
//关闭连接
|
|
//关闭连接
|
|
@@ -96,6 +98,7 @@ public class HttpHelper {
|
|
try {
|
|
try {
|
|
br.close();
|
|
br.close();
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
|
|
+ NcLog.info(e.getMessage());
|
|
ExceptionUtils.wrappBusinessException(e.getMessage());
|
|
ExceptionUtils.wrappBusinessException(e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -103,6 +106,7 @@ public class HttpHelper {
|
|
try {
|
|
try {
|
|
os.close();
|
|
os.close();
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
|
|
+ NcLog.info(e.getMessage());
|
|
ExceptionUtils.wrappBusinessException(e.getMessage());
|
|
ExceptionUtils.wrappBusinessException(e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -110,6 +114,7 @@ public class HttpHelper {
|
|
try {
|
|
try {
|
|
is.close();
|
|
is.close();
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
|
|
+ NcLog.info(e.getMessage());
|
|
ExceptionUtils.wrappBusinessException(e.getMessage());
|
|
ExceptionUtils.wrappBusinessException(e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|