Hi Roy, thanks for response!
I updated to newest version (1.0 RELEASE) to try it on it, but it seems a little bit worse - there are no predefined converters in restTemplate.
Code:
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.setContentType(new MediaType("application", "x-www-form-urlencoded"));
HttpEntity<CheckLoginRequest> requestEntity = new HttpEntity<CheckLoginRequest>(request, requestHeaders);
RestTemplate restTemplate = new RestTemplate();
restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory());
/*
FormHttpMessageConverter converter = new FormHttpMessageConverter();
List<MediaType> mediaTypes = new ArrayList<MediaType>();
mediaTypes.add(new MediaType("application", "x-www-form-urlencoded"));
converter.setSupportedMediaTypes(mediaTypes);
restTemplate.getMessageConverters().add(converter);
*/
for(HttpMessageConverter conv : restTemplate.getMessageConverters()) {
printout(conv.toString());
}
Prints out nothing. When uncommented, it prints out org.springframework.http.converter.FormHttpMessage Converter@12345, which is okay. But my problem persists :-(.
I tried it call with apache's HttpClient PostMethod before this, so I'm sure that server endpoint accepts that mimetype.
My calling does not use MultiValueMap, because it's not submitting form data, server side is badly implemented - it should listen (and return) for application/json, but it accepts only x-www-form-urlencoded instead, but I cant do anything with that :-(. My calling looks like this:
Code:
final String url = "http://foo.bar/herp";
ResponseEntity<CheckLoginResponse> responseEntity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, CheckLoginResponse.class);
CheckLoginResponse result = responseEntity.getBody();