I'm getting a HttpMessageNotReadableException when I try to do a get with spring in java. The Stacktrace printed says:
nested exception is org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Illegal character ((CTRL-CHAR, code 31)): only regular white space (\r, \n, \t) is allowed between tokens
Has it something to do with the way I do the get, or something to do with the format of my response?
The way I'm calling it is:
HttpEntity<JSONObject> entity = new HttpEntity<JSONObject>();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("Accept", "application/x-gzip");
headers.set("charset", "UTF-8");
return getConnector().exchange(url, HttpMethod.GET, entity, JSONObject.class);
getConnector() returns a RestConnector
The response headers include: Content-Encoding: gzip Content-Type: application/json
I don't know if it has something to do with the encoding being gzip
EDIT: The problem was that the content-encoding was gzip..finally, I used HttpClient which supports gzip encoding