减少工具类异常抛出
增加异常捕获和处理
This commit is contained in:
parent
f570919d78
commit
42276c8ac0
@ -173,7 +173,7 @@ public class HttpClientUtils {
|
|||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static HttpClientResult doPost(String url) throws Exception {
|
public static HttpClientResult doPost(String url) {
|
||||||
return doPost(url, null, null);
|
return doPost(url, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ public class HttpClientUtils {
|
|||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static HttpClientResult doPost(String url, Map<String, String> params) throws Exception {
|
public static HttpClientResult doPost(String url, Map<String, String> params) {
|
||||||
return doPost(url, null, params);
|
return doPost(url, null, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ public class HttpClientUtils {
|
|||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static HttpClientResult doPost(String url, Map<String, String> headers, Map<String, String> params) throws Exception {
|
public static HttpClientResult doPost(String url, Map<String, String> headers, Map<String, String> params) {
|
||||||
// 创建httpClient对象
|
// 创建httpClient对象
|
||||||
CloseableHttpClient httpClient = getHttpClient();
|
CloseableHttpClient httpClient = getHttpClient();
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ public class HttpClientUtils {
|
|||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static HttpClientResult doPut(String url) throws Exception {
|
public static HttpClientResult doPut(String url) {
|
||||||
return doPut(url);
|
return doPut(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ public class HttpClientUtils {
|
|||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static HttpClientResult doPut(String url, Map<String, String> params) throws Exception {
|
public static HttpClientResult doPut(String url, Map<String, String> params) {
|
||||||
CloseableHttpClient httpClient = getHttpClient();
|
CloseableHttpClient httpClient = getHttpClient();
|
||||||
HttpPut httpPut = new HttpPut(url);
|
HttpPut httpPut = new HttpPut(url);
|
||||||
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(CONNECT_TIMEOUT).setSocketTimeout(SOCKET_TIMEOUT).build();
|
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(CONNECT_TIMEOUT).setSocketTimeout(SOCKET_TIMEOUT).build();
|
||||||
|
Loading…
Reference in New Issue
Block a user