On 4 January 2013 15:22, <[email protected]> wrote: > Author: olegk > Date: Fri Jan 4 15:22:30 2013 > New Revision: 1428925 > > URL: http://svn.apache.org/viewvc?rev=1428925&view=rev > Log: > Added static #copy method to config classes > > Modified: > > httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheConfig.java > > httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java > > Modified: > httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheConfig.java > URL: > http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheConfig.java?rev=1428925&r1=1428924&r2=1428925&view=diff > ============================================================================== > --- > httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheConfig.java > (original) > +++ > httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheConfig.java > Fri Jan 4 15:22:30 2013 > @@ -26,6 +26,8 @@ > */ > package org.apache.http.impl.client.cache; > > +import org.apache.http.util.Args; > + > /** > * <p>Java Beans-style configuration for a {@link CachingHttpClient}. Any > class > * in the caching module that has configuration options should take a > @@ -468,6 +470,24 @@ public class CacheConfig implements Clon > return new Builder(); > } > > + public static Builder copy(final CacheConfig config) { > + Args.notNull(config, "Cache config"); > + return new Builder() > + .setMaxObjectSize(config.getMaxObjectSize()) > + .setMaxCacheEntries(config.getMaxCacheEntries()) > + .setMaxUpdateRetries(config.getMaxUpdateRetries()) > + .setHeuristicCachingEnabled(config.isHeuristicCachingEnabled()) > + .setHeuristicCoefficient(config.getHeuristicCoefficient()) > + > .setHeuristicDefaultLifetime(config.getHeuristicDefaultLifetime()) > + .setSharedCache(config.isSharedCache()) > + .setAsynchronousWorkersMax(config.getAsynchronousWorkersMax()) > + .setAsynchronousWorkersCore(config.getAsynchronousWorkersCore()) > + > .setAsynchronousWorkerIdleLifetimeSecs(config.getAsynchronousWorkerIdleLifetimeSecs()) > + .setRevalidationQueueSize(config.getRevalidationQueueSize()) > + > .setNeverCacheHTTP10ResponsesWithQueryString(config.isNeverCacheHTTP10ResponsesWithQuery()); > + } > + > + > public static class Builder { > > private long maxObjectSize; > @@ -621,7 +641,7 @@ public class CacheConfig implements Clon > * to better emulate IE, which also never caches responses, > regardless of what caching > * headers may be present. > */ > - public Builder setNeverCache1_0ResponsesWithQueryString(boolean b) { > + public Builder setNeverCacheHTTP10ResponsesWithQueryString(boolean > b) {
This change was not mentioned in the log message - was it intentional? > this.neverCacheHTTP10ResponsesWithQuery = b; > return this; > } > > Modified: > httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java > URL: > http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java?rev=1428925&r1=1428924&r2=1428925&view=diff > ============================================================================== > --- > httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java > (original) > +++ > httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java > Fri Jan 4 15:22:30 2013 > @@ -177,6 +177,25 @@ public class RequestConfig implements Cl > return new Builder(); > } > > + public static RequestConfig.Builder copy(final RequestConfig config) { > + return new Builder() > + .setExpectContinueEnabled(config.isExpectContinueEnabled()) > + .setDefaultProxy(config.getDefaultProxy()) > + .setLocalAddress(config.getLocalAddress()) > + > .setStaleConnectionCheckEnabled(config.isStaleConnectionCheckEnabled()) > + .setCookieSpec(config.getCookieSpec()) > + .setRedirectsEnabled(config.isRedirectsEnabled()) > + .setRelativeRedirectsAllowed(config.isRelativeRedirectsAllowed()) > + .setCircularRedirectsAllowed(config.isCircularRedirectsAllowed()) > + .setMaxRedirects(config.getMaxRedirects()) > + .setAuthenticationEnabled(config.isAuthenticationEnabled()) > + > .setTargetPreferredAuthSchemes(config.getProxyPreferredAuthSchemes()) > + > .setProxyPreferredAuthSchemes(config.getProxyPreferredAuthSchemes()) > + > .setConnectionRequestTimeout(config.getConnectionRequestTimeout()) > + .setConnectTimeout(config.getConnectTimeout()) > + .setSocketTimeout(config.getSocketTimeout()); > + } > + > public static class Builder { > > private boolean expectContinueEnabled; > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
