Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java RestTemplate-如何使用';t载荷响应体_Java_Http_Resttemplate - Fatal编程技术网

Java RestTemplate-如何使用';t载荷响应体

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...

在我的项目中,我必须向第三方服务器发送大量http请求。每个响应中大约有30kb的html。所以,我想节省交通。有没有办法不加载响应?现在我使用RestTemplate发送请求,但如果需要使用其他东西,这不是问题。谢谢

编辑:

现在我发送的请求如下:

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请求?代码示例。