[java-identity-provider COMMIT] in /trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingp...

noreply at shibboleth.net noreply at shibboleth.net
Tue Feb 17 16:33:08 EST 2015


Author: putmanb
Date: Tue Feb 17 16:33:08 2015
New Revision: 7352

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7352&view=rev
Log:
JSE-12: Consider moving HttpClient FactoryBeans down from idp-profile-spring

Modified:
    trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/FileCachingHttpClientFactoryBean.java
    trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/HttpClientFactoryBean.java
    trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/InMemoryCachingHttpClientFactoryBean.java

Modified: trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/FileCachingHttpClientFactoryBean.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/FileCachingHttpClientFactoryBean.java?rev=7352&r1=7351&r2=7352&view=diff
==============================================================================
--- trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/FileCachingHttpClientFactoryBean.java (original)
+++ trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/FileCachingHttpClientFactoryBean.java Tue Feb 17 16:33:08 2015
@@ -17,78 +17,22 @@
 
 package net.shibboleth.idp.profile.spring.relyingparty.metadata;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import net.shibboleth.utilities.java.support.component.InitializableComponent;
-import net.shibboleth.utilities.java.support.httpclient.FileCachingHttpClientBuilder;
-import net.shibboleth.utilities.java.support.httpclient.HttpClientBuilder;
-
-import org.apache.http.client.HttpClient;
-import org.springframework.beans.factory.DisposableBean;
+import net.shibboleth.idp.Version;
 
 /**
- * Factory bean to accumulate the parameters into a {@link FileCachingHttpClientBuilder} 
- * and to then emit a {@link org.apache.http.client.HttpClient}.
+ * Factory bean customization for the Shiboleth IdP.
  */
-public class FileCachingHttpClientFactoryBean extends HttpClientFactoryBean implements DisposableBean {
+public class FileCachingHttpClientFactoryBean extends net.shibboleth.ext.spring.factory.FileCachingHttpClientFactoryBean {
     
-    /** List of HttpClients produced by this factory, used to invoke their destroy() 
-     * when this factory instances is destroy()-ed. */
-    private List<HttpClient> clientRefs;
-
-    /** Constructor. */
+    /**
+     * Constructor.
+     *
+     */
     public FileCachingHttpClientFactoryBean() {
         super();
-        clientRefs = new ArrayList<>();
+        final StringBuilder stringBuilder = new StringBuilder("ShibbolethIdp/");
+        stringBuilder.append(Version.getVersion()).append(" OpenSAML/").append(org.opensaml.core.Version.getVersion());
+        setUserAgent(stringBuilder.toString());
     }
 
-    /**
-     * Set the cache directory path.
-     * 
-     * @param cacheDirectory The cacheDirectory to set.
-     */
-    public void setCacheDirectory(String cacheDirectory) {
-        ((FileCachingHttpClientBuilder)getHttpClientBuilder()).setCacheDirectory(cacheDirectory);
-    }
-
-    /**
-     * Set the maximum number of cached responses.
-     * 
-     * @param maxCacheEntries The maxCacheEntries to set.
-     */
-    public void setMaxCacheEntries(int maxCacheEntries) {
-        ((FileCachingHttpClientBuilder)getHttpClientBuilder()).setMaxCacheEntries(maxCacheEntries);
-    }
-
-    /**
-     * Set the maximum response body size, in bytes, that will be eligible for caching.
-     * 
-     * @param maxCacheEntrySize The maxCacheEntrySize to set.
-     */
-    public void setMaxCacheEntrySize(long maxCacheEntrySize) {
-        ((FileCachingHttpClientBuilder)getHttpClientBuilder()).setMaxCacheEntrySize(maxCacheEntrySize);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected HttpClientBuilder createHttpClientBuilder() {
-        return new FileCachingHttpClientBuilder();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected HttpClient doCreateInstance() throws Exception {
-        HttpClient client = super.doCreateInstance();
-        synchronized(this) {
-            if (client instanceof InitializableComponent) {
-                InitializableComponent component = (InitializableComponent) client;
-                if (!component.isInitialized()) {
-                   component.initialize(); 
-                }
-            }
-            clientRefs.add(client);
-        }
-        return client;
-    }
 }

Modified: trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/HttpClientFactoryBean.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/HttpClientFactoryBean.java?rev=7352&r1=7351&r2=7352&view=diff
==============================================================================

[... 215 lines stripped ...]


More information about the commits mailing list