Skip to content

Commit

Permalink
CCUK-3473 Backport improvements from HOD client to IOD client :: Find 1.
Browse files Browse the repository at this point in the history
 0.2 predates the iod client so we need to update it explicitly
  • Loading branch information
ivo-miller-hpe committed Dec 15, 2015
1 parent 2bfae39 commit b34c5e8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<groupId>com.hp.autonomy.frontend.find</groupId>
<artifactId>find</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>
<packaging>war</packaging>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package com.hp.autonomy.frontend.find.configuration;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.hp.autonomy.frontend.configuration.Authentication;
Expand All @@ -16,8 +17,12 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.client.RestTemplate;

import java.util.Collections;

@Configuration
public class AppConfiguration {

Expand All @@ -26,19 +31,27 @@ public RestTemplate restTemplate() {
final HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();

httpClientBuilder
.setMaxConnPerRoute(20)
.setMaxConnTotal(120);
.setMaxConnPerRoute(20)
.setMaxConnTotal(120);

final String proxyHost = System.getProperty("find.https.proxyHost");

if(proxyHost != null) {
if (proxyHost != null) {
final Integer proxyPort = Integer.valueOf(System.getProperty("find.https.proxyPort", "80"));
httpClientBuilder.setProxy(new HttpHost(proxyHost, proxyPort));
}

final ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClientBuilder.build());

return new RestTemplate(requestFactory);
final RestTemplate restTemplate = new RestTemplate(requestFactory);

final MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
final ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
jackson2HttpMessageConverter.setObjectMapper(objectMapper);
restTemplate.setMessageConverters(Collections.<HttpMessageConverter<?>>singletonList(jackson2HttpMessageConverter));

return restTemplate;
}

@Bean(name = "dispatcherObjectMapper")
Expand Down

0 comments on commit b34c5e8

Please sign in to comment.