You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by GitBox <gi...@apache.org> on 2020/08/04 19:08:53 UTC

[GitHub] [httpcomponents-client] carterkozak commented on a change in pull request #244: HTTPCLIENT-2103: ManagedHttpClientConnectionFactory provides a fluent builder

carterkozak commented on a change in pull request #244:
URL: https://github.com/apache/httpcomponents-client/pull/244#discussion_r465268218



##########
File path: httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/ManagedHttpClientConnectionFactory.java
##########
@@ -139,4 +139,71 @@ public ManagedHttpClientConnection createConnection(final Socket socket) throws
         return conn;
     }
 
+    /**
+     * Create a new {@link Builder}.
+     *
+     * @since 5.1
+     */
+    public static Builder builder()  {
+        return new Builder();
+    }
+
+    /**
+     * Builder for {@link ManagedHttpClientConnectionFactory}.
+     *
+     * @since 5.1
+     */
+    public static final class Builder {
+
+        private Http1Config http1Config;
+        private CharCodingConfig charCodingConfig;
+        private ContentLengthStrategy incomingContentStrategy;
+        private ContentLengthStrategy outgoingContentStrategy;
+        private HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory;
+        private HttpMessageParserFactory<ClassicHttpResponse> responseParserFactory;
+
+        private Builder() {}
+
+        public Builder http1Config(final Http1Config http1Config) {
+            this.http1Config = http1Config;
+            return this;
+        }
+
+        public Builder charCodingConfig(final CharCodingConfig charCodingConfig) {
+            this.charCodingConfig = charCodingConfig;
+            return this;
+        }
+
+        public Builder incomingContentLengthStrategy(final ContentLengthStrategy incomingContentStrategy) {
+            this.incomingContentStrategy = incomingContentStrategy;
+            return this;
+        }
+
+        public Builder outgoingContentLengthStrategy(final ContentLengthStrategy outgoingContentStrategy) {

Review comment:
       `incomingContentLengthStrategy` and `outgoingContentLengthStrategy` slightly differ from the names used in core, which uses `incomingContentStrategy` `outgoingContentStrategy`. I think the specificity is helpful, so I'll PR into core to update names there as well since 5.1 has not yet been released.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org