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 2008/04/08 12:12:51 UTC
svn commit: r645824 - in /httpcomponents/httpcore/trunk: ./
module-main/src/main/java/org/apache/http/
module-nio/src/main/java/org/apache/http/nio/entity/
module-nio/src/main/java/org/apache/http/nio/protocol/
Author: olegk
Date: Tue Apr 8 03:12:41 2008
New Revision: 645824
URL: http://svn.apache.org/viewvc?rev=645824&view=rev
Log:
Made HttpEntity#consumeContent(), ProducingNHttpentity#finish(), ConsumingNHttpEntity#finish() methods more consistent as they basically serve the same purpose. HttpEntity#consumeContent() is expected to be renamed to HttpEntity#finish() in the next major release
Modified:
httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/HttpEntity.java
httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/entity/ConsumingNHttpEntity.java
httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/entity/ProducingNHttpEntity.java
httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpClientHandler.java
httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java
Modified: httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt?rev=645824&r1=645823&r2=645824&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Tue Apr 8 03:12:41 2008
@@ -3,6 +3,7 @@
* [HTTPCORE-157] ChunkedOutputStream#flush() now behaves consistently with the
specification of OutputStream#flush().
+ Oleg Kalnichevski <olegk at apache.org>
* [HTTPCORE-147] Fixed handling of requests with partially consumed content
in ThrottlingHttpServiceHandler.
Modified: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/HttpEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/HttpEntity.java?rev=645824&r1=645823&r2=645824&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/HttpEntity.java (original)
+++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/HttpEntity.java Tue Apr 8 03:12:41 2008
@@ -173,13 +173,15 @@
boolean isStreaming(); // don't expect an exception here
/**
- * Consumes the remaining content of a streamed entity.
+ * TODO: The name of this method is misnomer. It will be renamed to
+ * #finish() in the next major release.
+ * <br/>
* This method is called to indicate that the content of this entity
- * is no longer required.
- * Streamed entities should dispose of the remaining content, if any.
- * Self-contained entities can release allocated resources, but
- * are not required to do anything.
- * Wrapping entities should delegate this call to the wrapped entity.
+ * is no longer required. All entity implementations are expected to
+ * release all allocated resources as a result of this method
+ * invocation. Content streaming entities are also expected to
+ * dispose of the remaining content, if any. Wrapping entities should
+ * delegate this call to the wrapped entity.
* <br/>
* This method is of particular importance for entities being
* received from a {@link HttpConnection connection}. The entity
Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/entity/ConsumingNHttpEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/entity/ConsumingNHttpEntity.java?rev=645824&r1=645823&r2=645824&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/entity/ConsumingNHttpEntity.java (original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/entity/ConsumingNHttpEntity.java Tue Apr 8 03:12:41 2008
@@ -52,6 +52,6 @@
/**
* Notification that any resources allocated for reading can be released.
*/
- void finish();
+ void finish() throws IOException;
}
Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/entity/ProducingNHttpEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/entity/ProducingNHttpEntity.java?rev=645824&r1=645823&r2=645824&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/entity/ProducingNHttpEntity.java (original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/entity/ProducingNHttpEntity.java Tue Apr 8 03:12:41 2008
@@ -54,6 +54,6 @@
/**
* Notification that any resources allocated for writing can be released.
*/
- void finish();
+ void finish() throws IOException;
}
Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpClientHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpClientHandler.java?rev=645824&r1=645823&r2=645824&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpClientHandler.java (original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpClientHandler.java Tue Apr 8 03:12:41 2008
@@ -115,7 +115,13 @@
HttpContext context = conn.getContext();
ClientConnState connState = (ClientConnState) context.getAttribute(CONN_STATE);
- connState.reset();
+ try {
+ connState.reset();
+ } catch (IOException ex) {
+ if (this.eventListener != null) {
+ this.eventListener.fatalIOException(ex, conn);
+ }
+ }
this.execHandler.finalizeContext(context);
@@ -447,7 +453,7 @@
this.timeout = timeout;
}
- public void resetInput() {
+ public void resetInput() throws IOException {
this.response = null;
if (this.consumingEntity != null) {
this.consumingEntity.finish();
@@ -455,7 +461,7 @@
}
}
- public void resetOutput() {
+ public void resetOutput() throws IOException {
this.request = null;
if (this.producingEntity != null) {
this.producingEntity.finish();
@@ -464,7 +470,7 @@
this.outputState = READY;
}
- public void reset() {
+ public void reset() throws IOException {
resetInput();
resetOutput();
}
Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java?rev=645824&r1=645823&r2=645824&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java (original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java Tue Apr 8 03:12:41 2008
@@ -237,8 +237,13 @@
HttpContext context = conn.getContext();
ServerConnState connState = (ServerConnState) context.getAttribute(CONN_STATE);
- connState.reset();
-
+ try {
+ connState.reset();
+ } catch (IOException ex) {
+ if (this.eventListener != null) {
+ this.eventListener.fatalIOException(ex, conn);
+ }
+ }
if (this.eventListener != null) {
this.eventListener.connectionClosed(conn);
}
@@ -526,21 +531,21 @@
private volatile HttpException httpex;
private volatile boolean handled;
- public void finishInput() {
+ public void finishInput() throws IOException {
if (this.consumingEntity != null) {
this.consumingEntity.finish();
this.consumingEntity = null;
}
}
- public void finishOutput() {
+ public void finishOutput() throws IOException {
if (this.producingEntity != null) {
this.producingEntity.finish();
this.producingEntity = null;
}
}
- public void reset() {
+ public void reset() throws IOException {
finishInput();
this.request = null;
finishOutput();