hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1636719 - in /httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http: impl/nio/NHttpConnectionBase.java nio/NHttpConnection.java nio/protocol/HttpAsyncService.java
Date Tue, 04 Nov 2014 20:03:53 GMT
Author: olegk
Date: Tue Nov  4 20:03:53 2014
New Revision: 1636719

URL: http://svn.apache.org/r1636719
Log:
Added method to NHttpConnection to test availability of input data

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/NHttpConnection.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java?rev=1636719&r1=1636718&r2=1636719&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
Tue Nov  4 20:03:53 2014
@@ -413,6 +413,11 @@ public class NHttpConnectionBase
     }
 
     @Override
+    public boolean isDataAvailable() {
+        return this.session.hasBufferedInput();
+    }
+
+    @Override
     public InetAddress getLocalAddress() {
         final SocketAddress address = this.session.getLocalAddress();
         if (address instanceof InetSocketAddress) {

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/NHttpConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/NHttpConnection.java?rev=1636719&r1=1636718&r2=1636719&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/NHttpConnection.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/NHttpConnection.java
Tue Nov  4 20:03:53 2014
@@ -89,4 +89,13 @@ public interface NHttpConnection extends
      */
     HttpContext getContext();
 
+    /**
+     * Returns true if the connection has input available.
+     * @return {@code true} if there is data in the connection input buffer, {@code false}
+     *   otherwise.
+     *
+     * @since 5.0
+     */
+    boolean isDataAvailable();
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java?rev=1636719&r1=1636718&r2=1636719&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
Tue Nov  4 20:03:53 2014
@@ -57,7 +57,6 @@ import org.apache.http.nio.NHttpConnecti
 import org.apache.http.nio.NHttpServerConnection;
 import org.apache.http.nio.NHttpServerEventHandler;
 import org.apache.http.nio.entity.NStringEntity;
-import org.apache.http.nio.reactor.SessionBufferStatus;
 import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpCoreContext;
@@ -291,7 +290,7 @@ public class HttpAsyncService implements
             if (((HttpEntityEnclosingRequest) request).expectContinue()
                         && state.getResponseState() == MessageState.READY
                         && state.getPipeline().isEmpty()
-                        && !(conn instanceof SessionBufferStatus && ((SessionBufferStatus)
conn).hasBufferedInput())) {
+                        && !conn.isDataAvailable()) {
 
                 state.setRequestState(MessageState.ACK_EXPECTED);
                 final HttpResponse ack = this.responseFactory.newHttpResponse(HttpVersion.HTTP_1_1,



Mime
View raw message