You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2018/10/02 09:21:32 UTC
httpcomponents-core git commit: ReactiveEntityProducer: Accept
ContentType parameter
Repository: httpcomponents-core
Updated Branches:
refs/heads/master 9060f91e6 -> 45280cc6f
ReactiveEntityProducer: Accept ContentType parameter
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/45280cc6
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/45280cc6
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/45280cc6
Branch: refs/heads/master
Commit: 45280cc6f87f7c8ed472238ae1cd6279336b4aff
Parents: 9060f91
Author: Ryan Schmitt <ry...@amazon.com>
Authored: Fri Sep 28 12:21:31 2018 -0700
Committer: Ryan Schmitt <ry...@amazon.com>
Committed: Mon Oct 1 13:51:04 2018 -0700
----------------------------------------------------------------------
.../reactive/examples/ReactiveFullDuplexClientExample.java | 2 +-
.../org/apache/hc/core5/reactive/ReactiveEntityProducer.java | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/45280cc6/httpcore5-reactive/src/examples/org/apache/hc/core5/reactive/examples/ReactiveFullDuplexClientExample.java
----------------------------------------------------------------------
diff --git a/httpcore5-reactive/src/examples/org/apache/hc/core5/reactive/examples/ReactiveFullDuplexClientExample.java b/httpcore5-reactive/src/examples/org/apache/hc/core5/reactive/examples/ReactiveFullDuplexClientExample.java
index d71e1a4..f5c736f 100644
--- a/httpcore5-reactive/src/examples/org/apache/hc/core5/reactive/examples/ReactiveFullDuplexClientExample.java
+++ b/httpcore5-reactive/src/examples/org/apache/hc/core5/reactive/examples/ReactiveFullDuplexClientExample.java
@@ -119,7 +119,7 @@ public class ReactiveFullDuplexClientExample {
}
});
final AsyncEntityProducer reactiveEntityProducer = new ReactiveEntityProducer(publisher, -1,
- ContentType.TEXT_PLAIN.toString(), null);
+ ContentType.TEXT_PLAIN, null);
final URI requestUri = new URI(endpoint);
final BasicRequestProducer requestProducer = new BasicRequestProducer(
"POST", requestUri, reactiveEntityProducer);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/45280cc6/httpcore5-reactive/src/main/java/org/apache/hc/core5/reactive/ReactiveEntityProducer.java
----------------------------------------------------------------------
diff --git a/httpcore5-reactive/src/main/java/org/apache/hc/core5/reactive/ReactiveEntityProducer.java b/httpcore5-reactive/src/main/java/org/apache/hc/core5/reactive/ReactiveEntityProducer.java
index 2fc4a98..dcf521a 100644
--- a/httpcore5-reactive/src/main/java/org/apache/hc/core5/reactive/ReactiveEntityProducer.java
+++ b/httpcore5-reactive/src/main/java/org/apache/hc/core5/reactive/ReactiveEntityProducer.java
@@ -28,6 +28,7 @@ package org.apache.hc.core5.reactive;
import org.apache.hc.core5.annotation.Contract;
import org.apache.hc.core5.annotation.ThreadingBehavior;
+import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.nio.AsyncEntityProducer;
import org.apache.hc.core5.http.nio.DataStreamChannel;
import org.reactivestreams.Publisher;
@@ -48,7 +49,7 @@ public final class ReactiveEntityProducer implements AsyncEntityProducer {
private final ReactiveDataProducer reactiveDataProducer;
private final long contentLength;
- private final String contentType;
+ private final ContentType contentType;
private final String contentEncoding;
/**
@@ -62,7 +63,7 @@ public final class ReactiveEntityProducer implements AsyncEntityProducer {
public ReactiveEntityProducer(
final Publisher<ByteBuffer> publisher,
final long contentLength,
- final String contentType,
+ final ContentType contentType,
final String contentEncoding
) {
this.reactiveDataProducer = new ReactiveDataProducer(publisher);
@@ -103,7 +104,7 @@ public final class ReactiveEntityProducer implements AsyncEntityProducer {
@Override
public String getContentType() {
- return contentType;
+ return contentType != null ? contentType.toString() : null;
}
@Override