[Dubbo-2.7.7] Fix problem: Rest Protocol can't work when use Tomcat 8.0.x as Web Container#6402
Merged
mercyblitz merged 1 commit intoapache:masterfrom Jul 8, 2020
yiocio:master
Merged
[Dubbo-2.7.7] Fix problem: Rest Protocol can't work when use Tomcat 8.0.x as Web Container#6402mercyblitz merged 1 commit intoapache:masterfrom yiocio:master
mercyblitz merged 1 commit intoapache:masterfrom
yiocio:master
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
fix the problem: Rest Protocol can't work when use Tomcat 8.0.x as Web Container which is described by issue #6399
Brief changelog
TomcatHttpServer.java
Verifying this change
When we start Tomcat server by program for embedded Tomcat with version 8.0.x,
We can't set the connector by following steps:
We should set the connector as follow:
The point is the connector returned by tomcat would be added to service object which belong to tomcat, it's important for tomcat to start connector and listen on given port. But the key action is missed when using the first solution. one thing to note, the first solution is OK for tomcat with higher version(eg: 8.5.31). But, the second solution is compatible with all versions of Tomcat.
Additionally, we should create connector object by new Connector("HTTP/1.1") instead of new Connector("org.apache.coyote.http11.Http11NioProtocol"), because the first practice is more semantic. actually, org.apache.coyote.http11.Http11NioProtocol isn't protocol name, it just the name of implementation class for HTTP/1.1 protocol.