<facebook.app.id>NOT_SET</facebook.app.id>
<facebook.app.secret>NOT_SET</facebook.app.secret>
<facebook.app.canvas>NOT_SET</facebook.app.canvas>
+ <!-- settings for the Apache Commons Http-Client -->
+ <httpclient.timeout.connection>60000</httpclient.timeout.connection>
+ <httpclient.timeout.read>60000</httpclient.timeout.read>
+ <httpclient.logging.level>ERROR</httpclient.logging.level>
</properties>
<dependencies>
<artifactId>spring-security-crypto</artifactId>
<scope>runtime</scope>
</dependency>
+ <!-- Httpclient -->
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </dependency>
</dependencies>
<build>
+import org.apache.http.HttpRequestFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.social.UserIdSource;
import org.springframework.core.env.Environment;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.social.config.annotation.ConnectionFactoryConfigurer;
import org.springframework.social.config.annotation.EnableSocial;
import org.springframework.social.config.annotation.SocialConfigurerAdapter;
repository.findPrimaryConnection(Facebook.class);
return connection != null ? connection.getApi() : null;
}
+
+ /**
+ * Use the <code>HttpClient</code> from Apaches <code>HttpComponents</code>
+ * for HTTP-requests.
+ *
+ * We also configure shorter intervals for the connection timeout and the
+ * read timeout.
+ *
+ * @param env The {@link Environment}, to read additional parameters from.
+ * @return The alternative implementation of {@link HttpRequestFactory}.
+ */
+ @Bean
+ public HttpComponentsClientHttpRequestFactory requestFactory(Environment env)
+ {
+ HttpComponentsClientHttpRequestFactory factory =
+ new HttpComponentsClientHttpRequestFactory();
+ factory.setConnectTimeout(
+ Integer.parseInt(env.getProperty("httpclient.timeout.connection"))
+ );
+ factory.setReadTimeout(
+ Integer.parseInt(env.getProperty("httpclient.timeout.read"))
+ );
+ return factory;
+ }
}
server.ssl.key-store: keystore
server.ssl.key-store-password: secret
+httpclient.timeout.connection=@httpclient.timeout.connection@
+httpclient.timeout.read=@httpclient.timeout.read@
+
spring.thymeleaf.prefix=/thymeleaf/
spring.thymeleaf.cache=false
logging.level.org.springframework.social=debug
+logging.level.org.apache.http=@httpclient.logging.level@
+logging.level.org.apache.http.wire=ERROR
logging.level.de.juplo.yourshouter=info