use encoding in postJson Http request for Solr matcher
@@ -6,20 +6,22 @@ import org.springframework.context.annotation.Scope;
import org.springframework.http.*;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.stereotype.Component;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
+import java.nio.charset.Charset;
+
/**
* Service to use HTTP to request resources
- *
+ * <p/>
* User: hfriedrich
* Date: 04.05.2015
*/
@Component
@Scope("prototype")
-public class HttpService
-{
+public class HttpService {
private final Logger log = LoggerFactory.getLogger(getClass());
private RestTemplate restTemplate;
private HttpHeaders jsonHeaders;
@@ -40,6 +42,7 @@ public class HttpService
private void init(ClientHttpRequestFactory factory) {
restTemplate = new RestTemplate(factory);
+ restTemplate.getMessageConverters().add(new StringHttpMessageConverter(Charset.forName("UTF-8")));
jsonHeaders = new HttpHeaders();
jsonHeaders.add("Content-Type", "application/json");
jsonHeaders.add("Accept", "*/*");
