Return-Path: X-Original-To: apmail-hc-commits-archive@www.apache.org Delivered-To: apmail-hc-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E26AAE5C0 for ; Fri, 4 Jan 2013 15:12:12 +0000 (UTC) Received: (qmail 4100 invoked by uid 500); 4 Jan 2013 15:12:12 -0000 Delivered-To: apmail-hc-commits-archive@hc.apache.org Received: (qmail 4021 invoked by uid 500); 4 Jan 2013 15:12:11 -0000 Mailing-List: contact commits-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list commits@hc.apache.org Received: (qmail 3996 invoked by uid 99); 4 Jan 2013 15:12:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jan 2013 15:12:10 +0000 X-ASF-Spam-Status: No, hits=-1998.0 required=5.0 tests=ALL_TRUSTED,FB_GET_MEDS X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jan 2013 15:12:07 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 5188923888FE for ; Fri, 4 Jan 2013 15:11:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@hc.apache.org From: olegk@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130104151147.5188923888FE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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;