Java RestTemplate-如何使用';t载荷响应体
在我的项目中,我必须向第三方服务器发送大量http请求。每个响应中大约有30kb的html。所以,我想节省交通。有没有办法不加载响应?现在我使用RestTemplate发送请求,但如果需要使用其他东西,这不是问题。谢谢 编辑: 现在我发送的请求如下:Java RestTemplate-如何使用';t载荷响应体,java,http,resttemplate,Java,Http,Resttemplate,在我的项目中,我必须向第三方服务器发送大量http请求。每个响应中大约有30kb的html。所以,我想节省交通。有没有办法不加载响应?现在我使用RestTemplate发送请求,但如果需要使用其他东西,这不是问题。谢谢 编辑: 现在我发送的请求如下: public ResponseEntity<String> sendPost(Map<String, String> headers, Map<String, String> params, String...
public ResponseEntity<String> sendPost(Map<String, String> headers, Map<String, String> params, String... url)
{
String urlStr = url.length != 0 ? url[0] : BASE_URL + "index.php";
HttpEntity<String> entity = new HttpEntity<>(mapToString(params), mapToHeaders(headers));
RestTemplate restTemplate = new RestTemplate();
return restTemplate.postForEntity(urlStr, entity, String.class);
}
public ResponseEntity sendPost(映射头、映射参数、字符串…url)
{
字符串urlStr=url.length!=0?url[0]:BASE_url+“index.php”;
HttpEntity实体=新的HttpEntity(mapToString(params),mapToHeaders(headers));
RestTemplate RestTemplate=新RestTemplate();
返回restemplate.postForEntity(urlStr,entity,String.class);
}
如何发出http请求?代码示例。如何发出http请求?代码示例。