I am using a RestTemplate to consume a rest service that returning multiple lines of Json object using postman. But it returns only the first element.
I activated the log using : logging.level.org.apache.http=DEBUG Then I found all lines :
2020-02-06 18:49:17.046 DEBUG 84151 --- [nio-8080-exec-1] org.apache.http.wire : http-outgoing-0 << "b3[\r][\n]"
2020-02-06 18:49:17.046 DEBUG 84151 --- [nio-8080-exec-1] org.apache.http.wire : http-outgoing-0 << "{"targetOrder":0,"populationId":"71","to":1003319,"personIid":"a8a828ee89f6fd41d88fdd6bc7714779b0c5d4db4fcc6414d35e5801fad06aaa","from":1003319,"coverId":96,"type":"LOCAL_READY"}[\n]"
2020-02-06 18:49:17.046 DEBUG 84151 --- [nio-8080-exec-1] org.apache.http.wire : http-outgoing-0 << "[\r][\n]"
2020-02-06 18:49:17.060 DEBUG 84151 --- [nio-8080-exec-1] org.apache.http.wire : http-outgoing-0 << "b3[\r][\n]"
2020-02-06 18:49:17.061 DEBUG 84151 --- [nio-8080-exec-1] org.apache.http.wire : http-outgoing-0 << "{"targetOrder":0,"populationId":"71","to":1006569,"personIid":"02f1d37de11424a4dd558db2c10cb0159b5f379a843ca8646226ba8b59998bb0","from":1006569,"coverId":96,"type":"LOCAL_READY"}[\n]"
2020-02-06 18:49:17.061 DEBUG 84151 --- [nio-8080-exec-1] org.apache.http.wire : http-outgoing-0 << "[\r][\n]"
2020-02-06 18:49:17.061 DEBUG 84151 --- [nio-8080-exec-1] org.apache.http.wire : http-outgoing-0 << "b3[\r][\n]"
2020-02-06 18:49:17.061 DEBUG 84151 --- [nio-8080-exec-1] org.apache.http.wire : http-outgoing-0 << "{"targetOrder":0,"populationId":"71","to":1009703,"personIid":"5dc4eef92350c93cba70c02efbf289067a33ef231c87c610bf74daa51232d310","from":1009540,"coverId":96,"type":"LOCAL_READY"}[\n]"
2020-02-06 18:49:17.061 DEBUG 84151 --- [nio-8080-exec-1] org.apache.http.wire : http-outgoing-0 << "[\r][\n]"
But RestTemplate takes only the first line => ' "to":1003319'
Here my code :
@GetMapping("/person/{id}")
public Object getPersonCover(@PathVariable(value ="id") int id) throws IOException {
HttpHeaders headers = new HttpHeaders();
headers.set("x-token", SECRET_TOKEN");
HttpEntity entity = new HttpEntity(headers);
ResponseEntity<Object> response = restTemplate.exchange(
personCoverURL+id, HttpMethod.GET, entity,Object.class);
return response.getBody();// returns only the first line :(
}
I am using SpringBoot v2.1.4.RELEASE
> myBean = new ParameterizedTypeReference
– Matthias Feb 06 '20 at 18:22>() {};` What is the Content-Type of this response? For me it looks not Http/JSON conform.