hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1428917 - in /httpcomponents/httpcore/trunk: httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ httpcore/src/main/java/org/apache/http/config/
Date Fri, 04 Jan 2013 15:11:47 GMT
Author: olegk
Date: Fri Jan  4 15:11:46 2013
New Revision: 1428917

URL: http://svn.apache.org/viewvc?rev=1428917&view=rev
Log:
Added static #copy method to config classes

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOReactorConfig.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/ConnectionConfig.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/MessageConstraints.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/SocketConfig.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOReactorConfig.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOReactorConfig.java?rev=1428917&r1=1428916&r2=1428917&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOReactorConfig.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOReactorConfig.java
Fri Jan  4 15:11:46 2013
@@ -270,6 +270,21 @@ public final class IOReactorConfig imple
         return new Builder();
     }
 
+    public static Builder copy(final IOReactorConfig config) {
+        Args.notNull(config, "I/O reactor config");
+        return new Builder()
+            .setSelectInterval(config.getSelectInterval())
+            .setShutdownGracePeriod(config.getShutdownGracePeriod())
+            .setInterestOpQueued(config.isInterestOpQueued())
+            .setIoThreadCount(config.getIoThreadCount())
+            .setSoTimeout(config.getSoTimeout())
+            .setSoReuseAddress(config.isSoReuseAddress())
+            .setSoLinger(config.getSoLinger())
+            .setSoKeepAlive(config.isSoKeepalive())
+            .setTcpNoDelay(config.isTcpNoDelay())
+            .setConnectTimeout(config.getConnectTimeout());
+    }
+
     public static class Builder {
 
         private long selectInterval;

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/ConnectionConfig.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/ConnectionConfig.java?rev=1428917&r1=1428916&r2=1428917&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/ConnectionConfig.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/ConnectionConfig.java
Fri Jan  4 15:11:46 2013
@@ -32,6 +32,7 @@ import java.nio.charset.CodingErrorActio
 
 import org.apache.http.Consts;
 import org.apache.http.annotation.Immutable;
+import org.apache.http.util.Args;
 
 /**
  * HTTP connection configuration.
@@ -96,6 +97,15 @@ public class ConnectionConfig implements
         return new Builder();
     }
 
+    public static ConnectionConfig.Builder copy(final ConnectionConfig config) {
+        Args.notNull(config, "Connection config");
+        return new Builder()
+            .setCharset(config.getCharset())
+            .setMalformedInputAction(config.getMalformedInputAction())
+            .setUnmappableInputAction(config.getUnmappableInputAction())
+            .setMessageConstraints(config.getMessageConstraints());
+    }
+
     public static class Builder {
 
         private Charset charset;

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/MessageConstraints.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/MessageConstraints.java?rev=1428917&r1=1428916&r2=1428917&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/MessageConstraints.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/MessageConstraints.java
Fri Jan  4 15:11:46 2013
@@ -77,6 +77,13 @@ public class MessageConstraints implemen
         return new Builder();
     }
 
+    public static MessageConstraints.Builder copy(final MessageConstraints config) {
+        Args.notNull(config, "Message constraints");
+        return new Builder()
+            .setMaxHeaderCount(config.getMaxHeaderCount())
+            .setMaxLineLength(config.getMaxLineLength());
+    }
+
     public static class Builder {
 
         private int maxLineLength;

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/SocketConfig.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/SocketConfig.java?rev=1428917&r1=1428916&r2=1428917&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/SocketConfig.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/SocketConfig.java
Fri Jan  4 15:11:46 2013
@@ -30,6 +30,7 @@ package org.apache.http.config;
 import java.net.SocketOptions;
 
 import org.apache.http.annotation.Immutable;
+import org.apache.http.util.Args;
 
 /**
  * Socket configuration.
@@ -141,6 +142,16 @@ public class SocketConfig implements Clo
         return new Builder();
     }
 
+    public static SocketConfig.Builder copy(final SocketConfig config) {
+        Args.notNull(config, "Socket config");
+        return new Builder()
+            .setSoTimeout(config.getSoTimeout())
+            .setSoReuseAddress(config.isSoReuseAddress())
+            .setSoLinger(config.getSoLinger())
+            .setSoKeepAlive(config.isSoKeepAlive())
+            .setTcpNoDelay(config.isTcpNoDelay());
+    }
+
     public static class Builder {
 
         private int soTimeout;



Mime
View raw message