[prev in list] [next in list] [prev in thread] [next in thread]
List: httpcomponents-commits
Subject: svn commit: r1610390 - in /httpcomponents/httpcore/branches/4.3.x: httpcore-nio/src/main/java/org/ap
From: olegk () apache ! org
Date: 2014-07-14 11:42:34
Message-ID: 20140714114234.C2C1B23888D7 () eris ! apache ! org
[Download RAW message or body]
Author: olegk
Date: Mon Jul 14 11:42:34 2014
New Revision: 1610390
URL: http://svn.apache.org/r1610390
Log:
HTTPCORE-386: Added #toString() method
Contributed by Dmitry Potapov <potapov.d at gmail.com>
Modified:
httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/nio/entity/EntityAsyncContentProducer.java
httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestProducer.java
httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncResponseProducer.java
httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestProducer.java
httpcomponents/httpcore/branches/4.3.x/httpcore/src/main/java/org/apache/http/entity/AbstractHttpEntity.java
httpcomponents/httpcore/branches/4.3.x/httpcore/src/main/java/org/apache/http/message/BasicHttpRequest.java
httpcomponents/httpcore/branches/4.3.x/httpcore/src/main/java/org/apache/http/message/BasicHttpResponse.java
Modified: httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/nio/entity/EntityAsyncContentProducer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.3.x/httpcore-nio/ \
src/main/java/org/apache/http/nio/entity/EntityAsyncContentProducer.java?rev=1610390&r1=1610389&r2=1610390&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/nio/entity/EntityAsyncContentProducer.java \
(original)
+++ httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/nio/entity/EntityAsyncContentProducer.java \
Mon Jul 14 11:42:34 2014 @@ -92,4 +92,9 @@ public class EntityAsyncContentProducer
}
}
+ @Override
+ public String toString() {
+ return this.entity.toString();
+ }
+
}
Modified: httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestProducer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.3.x/httpcore-nio/ \
src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestProducer.java?rev=1610390&r1=1610389&r2=1610390&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestProducer.java \
(original)
+++ httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestProducer.java \
Mon Jul 14 11:42:34 2014 @@ -150,4 +150,17 @@ public class BasicAsyncRequestProducer \
i }
}
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append(this.target);
+ sb.append(' ');
+ sb.append(this.request);
+ if (this.producer != null) {
+ sb.append(' ');
+ sb.append(this.producer);
+ }
+ return sb.toString();
+ }
+
}
Modified: httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncResponseProducer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.3.x/httpcore-nio/ \
src/main/java/org/apache/http/nio/protocol/BasicAsyncResponseProducer.java?rev=1610390&r1=1610389&r2=1610390&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncResponseProducer.java \
(original)
+++ httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncResponseProducer.java \
Mon Jul 14 11:42:34 2014 @@ -125,4 +125,14 @@ public class BasicAsyncResponseProducer \
}
}
+ @Override
+ public String toString() {
+ final StringBuilder buf = new StringBuilder();
+ buf.append(this.response);
+ if (this.producer != null) {
+ buf.append(" ").append(this.producer);
+ }
+ return buf.toString();
+ }
+
}
Modified: httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestProducer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.3.x/httpcore-nio/ \
src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestProducer.java?rev=1610390&r1=1610389&r2=1610390&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestProducer.java \
(original)
+++ httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestProducer.java \
Mon Jul 14 11:42:34 2014 @@ -128,4 +128,9 @@ public class TestBasicAsyncRequestProduc
verify(contentProducer, times(1)).close();
}
+ @Test
+ public void testToString() {
+ Assert.assertEquals(target + " " + request + " " + contentProducer, \
producer.toString()); + }
+
}
Modified: httpcomponents/httpcore/branches/4.3.x/httpcore/src/main/java/org/apache/http/entity/AbstractHttpEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.3.x/httpcore/src/ \
main/java/org/apache/http/entity/AbstractHttpEntity.java?rev=1610390&r1=1610389&r2=1610390&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.3.x/httpcore/src/main/java/org/apache/http/entity/AbstractHttpEntity.java \
(original)
+++ httpcomponents/httpcore/branches/4.3.x/httpcore/src/main/java/org/apache/http/entity/AbstractHttpEntity.java \
Mon Jul 14 11:42:34 2014 @@ -188,4 +188,30 @@ public abstract class \
AbstractHttpEntity public void consumeContent() throws IOException {
}
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append('[');
+ if (contentType != null) {
+ sb.append("Content-Type: ");
+ sb.append(contentType.getValue());
+ sb.append(',');
+ }
+ if (contentEncoding != null) {
+ sb.append("Content-Encoding: ");
+ sb.append(contentEncoding.getValue());
+ sb.append(',');
+ }
+ final long len = getContentLength();
+ if (len >= 0) {
+ sb.append("Content-Length: ");
+ sb.append(len);
+ sb.append(',');
+ }
+ sb.append("Chunked: ");
+ sb.append(chunked);
+ sb.append(']');
+ return sb.toString();
+ }
+
}
Modified: httpcomponents/httpcore/branches/4.3.x/httpcore/src/main/java/org/apache/http/message/BasicHttpRequest.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.3.x/httpcore/src/ \
main/java/org/apache/http/message/BasicHttpRequest.java?rev=1610390&r1=1610389&r2=1610390&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.3.x/httpcore/src/main/java/org/apache/http/message/BasicHttpRequest.java \
(original)
+++ httpcomponents/httpcore/branches/4.3.x/httpcore/src/main/java/org/apache/http/message/BasicHttpRequest.java \
Mon Jul 14 11:42:34 2014 @@ -108,7 +108,7 @@ public class BasicHttpRequest extends Ab
@Override
public String toString() {
- return this.method + " " + this.uri + " " + this.headergroup;
+ return this.method + ' ' + this.uri + ' ' + this.headergroup;
}
}
Modified: httpcomponents/httpcore/branches/4.3.x/httpcore/src/main/java/org/apache/http/message/BasicHttpResponse.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.3.x/httpcore/src/ \
main/java/org/apache/http/message/BasicHttpResponse.java?rev=1610390&r1=1610389&r2=1610390&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.3.x/httpcore/src/main/java/org/apache/http/message/BasicHttpResponse.java \
(original)
+++ httpcomponents/httpcore/branches/4.3.x/httpcore/src/main/java/org/apache/http/message/BasicHttpResponse.java \
Mon Jul 14 11:42:34 2014 @@ -192,7 +192,7 @@ public class BasicHttpResponse extends A
}
public void setLocale(final Locale locale) {
- this.locale = Args.notNull(locale, "Locale");
+ this.locale = Args.notNull(locale, "Locale");
this.statusline = null;
}
@@ -212,7 +212,15 @@ public class BasicHttpResponse extends A
@Override
public String toString() {
- return getStatusLine() + " " + this.headergroup;
+ final StringBuilder sb = new StringBuilder();
+ sb.append(getStatusLine());
+ sb.append(' ');
+ sb.append(this.headergroup);
+ if (this.entity != null) {
+ sb.append(' ');
+ sb.append(this.entity);
+ }
+ return sb.toString();
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic