Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.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
Spring REST模板_Spring_Rest_Http Headers - Fatal编程技术网

Spring REST模板

Spring REST模板,spring,rest,http-headers,Spring,Rest,Http Headers,我如何更正询问?只返回200个OK状态,没有身体 我的代码: HttpHeaders headers = new HttpHeaders(); headers.add("Authorization", sessionId); HttpEntity<String> entity = new HttpEntity<String>("parameters", headers); ResponseEntity<

我如何更正询问?只返回200个OK状态,没有身体

我的代码:

  HttpHeaders headers = new HttpHeaders();
  headers.add("Authorization", sessionId);
  HttpEntity<String> entity = new HttpEntity<String>("parameters",
           headers);            
   ResponseEntity<String> result = restTemplate.exchange(url,
            HttpMethod.POST, entity , String.class);
HttpHeaders=newhttpheaders();
标题。添加(“授权”,sessionId);
HttpEntity=新的HttpEntity(“参数”,
标题);
ResponseEntity结果=restTemplate.exchange(url,
HttpMethod.POST,实体,String.class);
错误:

org.springframework.web.client.RestClientException:无法提取响应:未找到内容类型


如何解决此问题?

我了解如何使其成为HttpStatus HttpStatus=restTemplate.exchange(url、HttpMethod.POST、getEntity(sessionId)、null)。getStatusCode();