Package net.mingsoft.basic.util
Class RestTemplateUtil
java.lang.Object
net.mingsoft.basic.util.RestTemplateUtil
basic模块,spring RestTemplate工具类
- Version:
- 版本号:100-000-000
创建日期:2017年9月5日
历史修订: - Author:
- 铭飞开发团队
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> org.springframework.http.ResponseEntity<T>DELETE请求调用方式static <T> org.springframework.http.ResponseEntity<T>DELETE请求调用方式static <T> org.springframework.http.ResponseEntity<T>DELETE请求调用方式static <T> org.springframework.http.ResponseEntity<T>DELETE请求调用方式static <T> org.springframework.http.ResponseEntity<T>带请求头的DELETE请求调用方式static <T> org.springframework.http.ResponseEntity<T>带请求头的DELETE请求调用方式static <T> org.springframework.http.ResponseEntity<T>delete(String url, Map<String, String> headers, Object requestBody, Class<T> responseType, Object... uriVariables) 带请求头的DELETE请求调用方式static <T> org.springframework.http.ResponseEntity<T>delete(String url, Map<String, String> headers, Object requestBody, Class<T> responseType, Map<String, ?> uriVariables) 带请求头的DELETE请求调用方式static <T> org.springframework.http.ResponseEntity<T>delete(String url, org.springframework.http.HttpEntity<?> requestEntity, Class<T> responseType, Object... uriVariables) 自定义请求头和请求体的DELETE请求调用方式static <T> org.springframework.http.ResponseEntity<T>delete(String url, org.springframework.http.HttpEntity<?> requestEntity, Class<T> responseType, Map<String, ?> uriVariables) 自定义请求头和请求体的DELETE请求调用方式static <T> org.springframework.http.ResponseEntity<T>delete(String url, org.springframework.http.HttpHeaders headers, Class<T> responseType, Object... uriVariables) 带请求头的DELETE请求调用方式static <T> org.springframework.http.ResponseEntity<T>delete(String url, org.springframework.http.HttpHeaders headers, Class<T> responseType, Map<String, ?> uriVariables) 带请求头的DELETE请求调用方式static <T> org.springframework.http.ResponseEntity<T>delete(String url, org.springframework.http.HttpHeaders headers, Object requestBody, Class<T> responseType, Object... uriVariables) 带请求头的DELETE请求调用方式static <T> org.springframework.http.ResponseEntity<T>delete(String url, org.springframework.http.HttpHeaders headers, Object requestBody, Class<T> responseType, Map<String, ?> uriVariables) 带请求头的DELETE请求调用方式static <T> org.springframework.http.ResponseEntity<T>exchange(String url, org.springframework.http.HttpMethod method, org.springframework.http.HttpEntity<?> requestEntity, Class<T> responseType, Object... uriVariables) 通用调用方式static <T> org.springframework.http.ResponseEntity<T>exchange(String url, org.springframework.http.HttpMethod method, org.springframework.http.HttpEntity<?> requestEntity, Class<T> responseType, Map<String, ?> uriVariables) 通用调用方式static <T> org.springframework.http.ResponseEntity<T>GET请求调用方式static <T> org.springframework.http.ResponseEntity<T>GET请求调用方式static <T> org.springframework.http.ResponseEntity<T>GET请求调用方式static <T> org.springframework.http.ResponseEntity<T>带请求头的GET请求调用方式static <T> org.springframework.http.ResponseEntity<T>带请求头的GET请求调用方式static <T> org.springframework.http.ResponseEntity<T>get(String url, org.springframework.http.HttpHeaders headers, Class<T> responseType, Object... uriVariables) 带请求头的GET请求调用方式static <T> org.springframework.http.ResponseEntity<T>get(String url, org.springframework.http.HttpHeaders headers, Class<T> responseType, Map<String, ?> uriVariables) 带请求头的GET请求调用方式static org.springframework.http.HttpHeadersgetHeaders(jakarta.servlet.http.HttpServletRequest request) static org.springframework.web.client.RestTemplate获取RestTemplate实例对象,可自由调用其方法static <T> org.springframework.http.ResponseEntity<T>POST请求调用方式static <T> org.springframework.http.ResponseEntity<T>POST请求调用方式static <T> org.springframework.http.ResponseEntity<T>POST请求调用方式static <T> org.springframework.http.ResponseEntity<T>POST请求调用方式static <T> org.springframework.http.ResponseEntity<T>post(String url, Map<String, String> headers, Object requestBody, Class<T> responseType, Object... uriVariables) 带请求头的POST请求调用方式static <T> org.springframework.http.ResponseEntity<T>post(String url, Map<String, String> headers, Object requestBody, Class<T> responseType, Map<String, ?> uriVariables) 带请求头的POST请求调用方式static <T> org.springframework.http.ResponseEntity<T>post(String url, org.springframework.http.HttpEntity<?> requestEntity, Class<T> responseType, Object... uriVariables) 自定义请求头和请求体的POST请求调用方式static <T> org.springframework.http.ResponseEntity<T>post(String url, org.springframework.http.HttpEntity<?> requestEntity, Class<T> responseType, Map<String, ?> uriVariables) 自定义请求头和请求体的POST请求调用方式static <T> org.springframework.http.ResponseEntity<T>post(String url, org.springframework.http.HttpHeaders headers, Object requestBody, Class<T> responseType, Object... uriVariables) 带请求头的POST请求调用方式static <T> org.springframework.http.ResponseEntity<T>post(String url, org.springframework.http.HttpHeaders headers, Object requestBody, Class<T> responseType, Map<String, ?> uriVariables) 带请求头的POST请求调用方式static <T> org.springframework.http.ResponseEntity<T>PUT请求调用方式static <T> org.springframework.http.ResponseEntity<T>PUT请求调用方式static <T> org.springframework.http.ResponseEntity<T>PUT请求调用方式static <T> org.springframework.http.ResponseEntity<T>put(String url, Map<String, String> headers, Object requestBody, Class<T> responseType, Object... uriVariables) 带请求头的PUT请求调用方式static <T> org.springframework.http.ResponseEntity<T>put(String url, Map<String, String> headers, Object requestBody, Class<T> responseType, Map<String, ?> uriVariables) 带请求头的PUT请求调用方式static <T> org.springframework.http.ResponseEntity<T>put(String url, org.springframework.http.HttpEntity<?> requestEntity, Class<T> responseType, Object... uriVariables) 自定义请求头和请求体的PUT请求调用方式static <T> org.springframework.http.ResponseEntity<T>put(String url, org.springframework.http.HttpEntity<?> requestEntity, Class<T> responseType, Map<String, ?> uriVariables) 自定义请求头和请求体的PUT请求调用方式static <T> org.springframework.http.ResponseEntity<T>put(String url, org.springframework.http.HttpHeaders headers, Object requestBody, Class<T> responseType, Object... uriVariables) 带请求头的PUT请求调用方式static <T> org.springframework.http.ResponseEntity<T>put(String url, org.springframework.http.HttpHeaders headers, Object requestBody, Class<T> responseType, Map<String, ?> uriVariables) 带请求头的PUT请求调用方式
-
Constructor Details
-
RestTemplateUtil
public RestTemplateUtil()
-
-
Method Details
-
getHeaders
public static org.springframework.http.HttpHeaders getHeaders(jakarta.servlet.http.HttpServletRequest request) -
get
GET请求调用方式- Parameters:
url- 请求URLresponseType- 返回对象类型- Returns:
- ResponseEntity 响应对象封装类
-
get
public static <T> org.springframework.http.ResponseEntity<T> get(String url, Class<T> responseType, Object... uriVariables) GET请求调用方式- Parameters:
url- 请求URLresponseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
get
public static <T> org.springframework.http.ResponseEntity<T> get(String url, Class<T> responseType, Map<String, ?> uriVariables) GET请求调用方式- Parameters:
url- 请求URLresponseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
get
public static <T> org.springframework.http.ResponseEntity<T> get(String url, Map<String, String> headers, Class<T> responseType, Object... uriVariables) 带请求头的GET请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数responseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
get
public static <T> org.springframework.http.ResponseEntity<T> get(String url, org.springframework.http.HttpHeaders headers, Class<T> responseType, Object... uriVariables) 带请求头的GET请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数responseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
get
public static <T> org.springframework.http.ResponseEntity<T> get(String url, Map<String, String> headers, Class<T> responseType, Map<String, ?> uriVariables) 带请求头的GET请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数responseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
get
public static <T> org.springframework.http.ResponseEntity<T> get(String url, org.springframework.http.HttpHeaders headers, Class<T> responseType, Map<String, ?> uriVariables) 带请求头的GET请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数responseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
post
public static <T> org.springframework.http.ResponseEntity<T> post(String url, Class<T> responseType) POST请求调用方式- Parameters:
url- 请求URLresponseType- 返回对象类型- Returns:
-
post
public static <T> org.springframework.http.ResponseEntity<T> post(String url, Object requestBody, Class<T> responseType) POST请求调用方式- Parameters:
url- 请求URLrequestBody- 请求参数体responseType- 返回对象类型- Returns:
- ResponseEntity 响应对象封装类
-
post
public static <T> org.springframework.http.ResponseEntity<T> post(String url, Object requestBody, Class<T> responseType, Object... uriVariables) POST请求调用方式- Parameters:
url- 请求URLrequestBody- 请求参数体responseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
post
public static <T> org.springframework.http.ResponseEntity<T> post(String url, Object requestBody, Class<T> responseType, Map<String, ?> uriVariables) POST请求调用方式- Parameters:
url- 请求URLrequestBody- 请求参数体responseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
post
public static <T> org.springframework.http.ResponseEntity<T> post(String url, Map<String, String> headers, Object requestBody, Class<T> responseType, Object... uriVariables) 带请求头的POST请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数requestBody- 请求参数体responseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
post
public static <T> org.springframework.http.ResponseEntity<T> post(String url, org.springframework.http.HttpHeaders headers, Object requestBody, Class<T> responseType, Object... uriVariables) 带请求头的POST请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数requestBody- 请求参数体responseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
post
public static <T> org.springframework.http.ResponseEntity<T> post(String url, Map<String, String> headers, Object requestBody, Class<T> responseType, Map<String, ?> uriVariables) 带请求头的POST请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数requestBody- 请求参数体responseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
post
public static <T> org.springframework.http.ResponseEntity<T> post(String url, org.springframework.http.HttpHeaders headers, Object requestBody, Class<T> responseType, Map<String, ?> uriVariables) 带请求头的POST请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数requestBody- 请求参数体responseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
post
public static <T> org.springframework.http.ResponseEntity<T> post(String url, org.springframework.http.HttpEntity<?> requestEntity, Class<T> responseType, Object... uriVariables) 自定义请求头和请求体的POST请求调用方式- Parameters:
url- 请求URLrequestEntity- 请求头和请求体封装对象responseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
post
public static <T> org.springframework.http.ResponseEntity<T> post(String url, org.springframework.http.HttpEntity<?> requestEntity, Class<T> responseType, Map<String, ?> uriVariables) 自定义请求头和请求体的POST请求调用方式- Parameters:
url- 请求URLrequestEntity- 请求头和请求体封装对象responseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
put
public static <T> org.springframework.http.ResponseEntity<T> put(String url, Class<T> responseType, Object... uriVariables) PUT请求调用方式- Parameters:
url- 请求URLresponseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
put
public static <T> org.springframework.http.ResponseEntity<T> put(String url, Object requestBody, Class<T> responseType, Object... uriVariables) PUT请求调用方式- Parameters:
url- 请求URLrequestBody- 请求参数体responseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
put
public static <T> org.springframework.http.ResponseEntity<T> put(String url, Object requestBody, Class<T> responseType, Map<String, ?> uriVariables) PUT请求调用方式- Parameters:
url- 请求URLrequestBody- 请求参数体responseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
put
public static <T> org.springframework.http.ResponseEntity<T> put(String url, Map<String, String> headers, Object requestBody, Class<T> responseType, Object... uriVariables) 带请求头的PUT请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数requestBody- 请求参数体responseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
put
public static <T> org.springframework.http.ResponseEntity<T> put(String url, org.springframework.http.HttpHeaders headers, Object requestBody, Class<T> responseType, Object... uriVariables) 带请求头的PUT请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数requestBody- 请求参数体responseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
put
public static <T> org.springframework.http.ResponseEntity<T> put(String url, Map<String, String> headers, Object requestBody, Class<T> responseType, Map<String, ?> uriVariables) 带请求头的PUT请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数requestBody- 请求参数体responseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
put
public static <T> org.springframework.http.ResponseEntity<T> put(String url, org.springframework.http.HttpHeaders headers, Object requestBody, Class<T> responseType, Map<String, ?> uriVariables) 带请求头的PUT请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数requestBody- 请求参数体responseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
put
public static <T> org.springframework.http.ResponseEntity<T> put(String url, org.springframework.http.HttpEntity<?> requestEntity, Class<T> responseType, Object... uriVariables) 自定义请求头和请求体的PUT请求调用方式- Parameters:
url- 请求URLrequestEntity- 请求头和请求体封装对象responseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
put
public static <T> org.springframework.http.ResponseEntity<T> put(String url, org.springframework.http.HttpEntity<?> requestEntity, Class<T> responseType, Map<String, ?> uriVariables) 自定义请求头和请求体的PUT请求调用方式- Parameters:
url- 请求URLrequestEntity- 请求头和请求体封装对象responseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
delete
public static <T> org.springframework.http.ResponseEntity<T> delete(String url, Class<T> responseType, Object... uriVariables) DELETE请求调用方式- Parameters:
url- 请求URLresponseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
delete
public static <T> org.springframework.http.ResponseEntity<T> delete(String url, Class<T> responseType, Map<String, ?> uriVariables) DELETE请求调用方式- Parameters:
url- 请求URLresponseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
delete
public static <T> org.springframework.http.ResponseEntity<T> delete(String url, Object requestBody, Class<T> responseType, Object... uriVariables) DELETE请求调用方式- Parameters:
url- 请求URLrequestBody- 请求参数体responseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
delete
public static <T> org.springframework.http.ResponseEntity<T> delete(String url, Object requestBody, Class<T> responseType, Map<String, ?> uriVariables) DELETE请求调用方式- Parameters:
url- 请求URLrequestBody- 请求参数体responseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
delete
public static <T> org.springframework.http.ResponseEntity<T> delete(String url, Map<String, String> headers, Class<T> responseType, Object... uriVariables) 带请求头的DELETE请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数responseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
delete
public static <T> org.springframework.http.ResponseEntity<T> delete(String url, org.springframework.http.HttpHeaders headers, Class<T> responseType, Object... uriVariables) 带请求头的DELETE请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数responseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
delete
public static <T> org.springframework.http.ResponseEntity<T> delete(String url, Map<String, String> headers, Class<T> responseType, Map<String, ?> uriVariables) 带请求头的DELETE请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数responseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
delete
public static <T> org.springframework.http.ResponseEntity<T> delete(String url, org.springframework.http.HttpHeaders headers, Class<T> responseType, Map<String, ?> uriVariables) 带请求头的DELETE请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数responseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
delete
public static <T> org.springframework.http.ResponseEntity<T> delete(String url, Map<String, String> headers, Object requestBody, Class<T> responseType, Object... uriVariables) 带请求头的DELETE请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数requestBody- 请求参数体responseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
delete
public static <T> org.springframework.http.ResponseEntity<T> delete(String url, org.springframework.http.HttpHeaders headers, Object requestBody, Class<T> responseType, Object... uriVariables) 带请求头的DELETE请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数requestBody- 请求参数体responseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
delete
public static <T> org.springframework.http.ResponseEntity<T> delete(String url, Map<String, String> headers, Object requestBody, Class<T> responseType, Map<String, ?> uriVariables) 带请求头的DELETE请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数requestBody- 请求参数体responseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
delete
public static <T> org.springframework.http.ResponseEntity<T> delete(String url, org.springframework.http.HttpHeaders headers, Object requestBody, Class<T> responseType, Map<String, ?> uriVariables) 带请求头的DELETE请求调用方式- Parameters:
url- 请求URLheaders- 请求头参数requestBody- 请求参数体responseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
delete
public static <T> org.springframework.http.ResponseEntity<T> delete(String url, org.springframework.http.HttpEntity<?> requestEntity, Class<T> responseType, Object... uriVariables) 自定义请求头和请求体的DELETE请求调用方式- Parameters:
url- 请求URLrequestEntity- 请求头和请求体封装对象responseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
delete
public static <T> org.springframework.http.ResponseEntity<T> delete(String url, org.springframework.http.HttpEntity<?> requestEntity, Class<T> responseType, Map<String, ?> uriVariables) 自定义请求头和请求体的DELETE请求调用方式- Parameters:
url- 请求URLrequestEntity- 请求头和请求体封装对象responseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
exchange
public static <T> org.springframework.http.ResponseEntity<T> exchange(String url, org.springframework.http.HttpMethod method, org.springframework.http.HttpEntity<?> requestEntity, Class<T> responseType, Object... uriVariables) 通用调用方式- Parameters:
url- 请求URLmethod- 请求方法类型requestEntity- 请求头和请求体封装对象responseType- 返回对象类型uriVariables- URL中的变量,按顺序依次对应- Returns:
- ResponseEntity 响应对象封装类
-
exchange
public static <T> org.springframework.http.ResponseEntity<T> exchange(String url, org.springframework.http.HttpMethod method, org.springframework.http.HttpEntity<?> requestEntity, Class<T> responseType, Map<String, ?> uriVariables) 通用调用方式- Parameters:
url- 请求URLmethod- 请求方法类型requestEntity- 请求头和请求体封装对象responseType- 返回对象类型uriVariables- URL中的变量,与Map中的key对应- Returns:
- ResponseEntity 响应对象封装类
-
getRestTemplate
public static org.springframework.web.client.RestTemplate getRestTemplate()获取RestTemplate实例对象,可自由调用其方法- Returns:
- RestTemplate实例对象
-