Author: markt Date: Tue Sep 5 09:43:44 2017 New Revision: 1807325 URL: http://svn.apache.org/viewvc?rev=1807325&view=rev Log: Refactor: Make Http2Protocol available to Http2UpgradeHandler. This will enable some duplicated properties to be removed.
Modified: tomcat/trunk/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java tomcat/trunk/java/org/apache/coyote/http2/Http2Protocol.java tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java tomcat/trunk/test/org/apache/coyote/http2/TestAbstractStream.java Modified: tomcat/trunk/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java?rev=1807325&r1=1807324&r2=1807325&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java (original) +++ tomcat/trunk/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java Tue Sep 5 09:43:44 2017 @@ -36,8 +36,9 @@ public class Http2AsyncUpgradeHandler ex private Throwable error = null; private IOException applicationIOE = null; - public Http2AsyncUpgradeHandler(Adapter adapter, Request coyoteRequest) { - super (adapter, coyoteRequest); + public Http2AsyncUpgradeHandler(Http2Protocol protocol, Adapter adapter, + Request coyoteRequest) { + super (protocol, adapter, coyoteRequest); } private CompletionHandler<Long, Void> errorCompletion = new CompletionHandler<Long, Void>() { Modified: tomcat/trunk/java/org/apache/coyote/http2/Http2Protocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Http2Protocol.java?rev=1807325&r1=1807324&r2=1807325&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/Http2Protocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/http2/Http2Protocol.java Tue Sep 5 09:43:44 2017 @@ -102,8 +102,8 @@ public class Http2Protocol implements Up public InternalHttpUpgradeHandler getInternalUpgradeHandler(SocketWrapperBase<?> socketWrapper, Adapter adapter, Request coyoteRequest) { Http2UpgradeHandler result = (socketWrapper.hasAsyncIO()) - ? new Http2AsyncUpgradeHandler(adapter, coyoteRequest) - : new Http2UpgradeHandler(adapter, coyoteRequest); + ? new Http2AsyncUpgradeHandler(this, adapter, coyoteRequest) + : new Http2UpgradeHandler(this, adapter, coyoteRequest); result.setReadTimeout(getReadTimeout()); result.setKeepAliveTimeout(getKeepAliveTimeout()); Modified: tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java?rev=1807325&r1=1807324&r2=1807325&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java (original) +++ tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java Tue Sep 5 09:43:44 2017 @@ -96,6 +96,7 @@ class Http2UpgradeHandler extends Abstra protected final String connectionId; + private final Http2Protocol protocol; private final Adapter adapter; protected volatile SocketWrapperBase<?> socketWrapper; private volatile SSLSupport sslSupport; @@ -151,8 +152,9 @@ class Http2UpgradeHandler extends Abstra private int maxTrailerSize = Constants.DEFAULT_MAX_TRAILER_SIZE; - Http2UpgradeHandler(Adapter adapter, Request coyoteRequest) { + Http2UpgradeHandler(Http2Protocol protocol, Adapter adapter, Request coyoteRequest) { super (STREAM_ID_ZERO); + this.protocol = protocol; this.adapter = adapter; this.connectionId = Integer.toString(connectionIdGenerator.getAndIncrement()); Modified: tomcat/trunk/test/org/apache/coyote/http2/TestAbstractStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestAbstractStream.java?rev=1807325&r1=1807324&r2=1807325&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/coyote/http2/TestAbstractStream.java (original) +++ tomcat/trunk/test/org/apache/coyote/http2/TestAbstractStream.java Tue Sep 5 09:43:44 2017 @@ -28,7 +28,7 @@ public class TestAbstractStream { @Test public void testDependenciesFig3() { // Setup - Http2UpgradeHandler handler = new Http2UpgradeHandler(null, null); + Http2UpgradeHandler handler = new Http2UpgradeHandler(null, null, null); Stream a = new Stream(Integer.valueOf(1), handler); Stream b = new Stream(Integer.valueOf(2), handler); Stream c = new Stream(Integer.valueOf(3), handler); @@ -59,7 +59,7 @@ public class TestAbstractStream { @Test public void testDependenciesFig4() { // Setup - Http2UpgradeHandler handler = new Http2UpgradeHandler(null, null); + Http2UpgradeHandler handler = new Http2UpgradeHandler(null, null, null); Stream a = new Stream(Integer.valueOf(1), handler); Stream b = new Stream(Integer.valueOf(2), handler); Stream c = new Stream(Integer.valueOf(3), handler); @@ -90,7 +90,7 @@ public class TestAbstractStream { @Test public void testDependenciesFig5NonExclusive() { // Setup - Http2UpgradeHandler handler = new Http2UpgradeHandler(null, null); + Http2UpgradeHandler handler = new Http2UpgradeHandler(null, null, null); Stream a = new Stream(Integer.valueOf(1), handler); Stream b = new Stream(Integer.valueOf(2), handler); Stream c = new Stream(Integer.valueOf(3), handler); @@ -132,7 +132,7 @@ public class TestAbstractStream { @Test public void testDependenciesFig5Exclusive() { // Setup - Http2UpgradeHandler handler = new Http2UpgradeHandler(null, null); + Http2UpgradeHandler handler = new Http2UpgradeHandler(null, null, null); Stream a = new Stream(Integer.valueOf(1), handler); Stream b = new Stream(Integer.valueOf(2), handler); Stream c = new Stream(Integer.valueOf(3), handler); @@ -174,7 +174,7 @@ public class TestAbstractStream { @Test public void testCircular01() { // Setup - Http2UpgradeHandler handler = new Http2UpgradeHandler(null, null); + Http2UpgradeHandler handler = new Http2UpgradeHandler(null, null, null); Stream a = new Stream(Integer.valueOf(1), handler); Stream b = new Stream(Integer.valueOf(2), handler); Stream c = new Stream(Integer.valueOf(3), handler); @@ -204,7 +204,7 @@ public class TestAbstractStream { @Test public void testCircular02() { // Setup - Http2UpgradeHandler handler = new Http2UpgradeHandler(null, null); + Http2UpgradeHandler handler = new Http2UpgradeHandler(null, null, null); Stream a = new Stream(Integer.valueOf(1), handler); Stream b = new Stream(Integer.valueOf(2), handler); Stream c = new Stream(Integer.valueOf(3), handler); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org