You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2018/08/09 03:00:45 UTC
[incubator-dubbo] branch master updated: Merge pull request #2198,
Update Jetty to Version 9.
This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 518c596 Merge pull request #2198, Update Jetty to Version 9.
518c596 is described below
commit 518c5961e69ac6f1a5e48b193dc52b55d208f5d7
Author: Wang Yuan <31...@users.noreply.github.com>
AuthorDate: Thu Aug 9 11:00:39 2018 +0800
Merge pull request #2198, Update Jetty to Version 9.
Fixes #655
---
dubbo-dependencies-bom/pom.xml | 15 +++++++----
dubbo-registry/dubbo-registry-api/pom.xml | 8 ++++--
dubbo-remoting/dubbo-remoting-http/pom.xml | 14 +++++-----
.../dubbo/remoting/http/jetty/JettyHttpServer.java | 30 +++++++++++-----------
dubbo-rpc/dubbo-rpc-dubbo/pom.xml | 8 ++++--
pom.xml | 10 ++++----
6 files changed, 48 insertions(+), 37 deletions(-)
diff --git a/dubbo-dependencies-bom/pom.xml b/dubbo-dependencies-bom/pom.xml
index c5f3686..29ca7a7 100644
--- a/dubbo-dependencies-bom/pom.xml
+++ b/dubbo-dependencies-bom/pom.xml
@@ -29,8 +29,8 @@
<url>https://github.com/apache/incubator-dubbo</url>
<connection>scm:git:https://github.com/apache/incubator-dubbo.git</connection>
<developerConnection>scm:git:https://github.com/apache/incubator-dubbo.git</developerConnection>
- <tag>HEAD</tag>
- </scm>
+ <tag>HEAD</tag>
+ </scm>
<mailingLists>
<mailingList>
<name>Development List</name>
@@ -89,7 +89,7 @@
<thrift_version>0.8.0</thrift_version>
<hessian_version>4.0.38</hessian_version>
<servlet_version>3.1.0</servlet_version>
- <jetty_version>6.1.26</jetty_version>
+ <jetty_version>9.4.11.v20180605</jetty_version>
<validation_version>1.1.0.Final</validation_version>
<hibernate_validator_version>5.4.1.Final</hibernate_validator_version>
<jel_version>3.0.1-b08</jel_version>
@@ -215,8 +215,13 @@
<version>${servlet_version}</version>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ <version>${jetty_version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
<version>${jetty_version}</version>
</dependency>
<dependency>
diff --git a/dubbo-registry/dubbo-registry-api/pom.xml b/dubbo-registry/dubbo-registry-api/pom.xml
index 2437eae..018addd 100644
--- a/dubbo-registry/dubbo-registry-api/pom.xml
+++ b/dubbo-registry/dubbo-registry-api/pom.xml
@@ -40,8 +40,12 @@
<version>${project.parent.version}</version>
<exclusions>
<exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
</exclusion>
</exclusions>
</dependency>
diff --git a/dubbo-remoting/dubbo-remoting-http/pom.xml b/dubbo-remoting/dubbo-remoting-http/pom.xml
index 04132e8..755fdd0 100644
--- a/dubbo-remoting/dubbo-remoting-http/pom.xml
+++ b/dubbo-remoting/dubbo-remoting-http/pom.xml
@@ -35,14 +35,12 @@
<version>${project.parent.version}</version>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- </exclusions>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/jetty/JettyHttpServer.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/jetty/JettyHttpServer.java
index 714c8ff..6ff19df 100644
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/jetty/JettyHttpServer.java
+++ b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/jetty/JettyHttpServer.java
@@ -26,14 +26,14 @@ import org.apache.dubbo.remoting.http.servlet.DispatcherServlet;
import org.apache.dubbo.remoting.http.servlet.ServletManager;
import org.apache.dubbo.remoting.http.support.AbstractHttpServer;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.nio.SelectChannelConnector;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.ServletHandler;
-import org.mortbay.jetty.servlet.ServletHolder;
-import org.mortbay.log.Log;
-import org.mortbay.log.StdErrLog;
-import org.mortbay.thread.QueuedThreadPool;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.util.log.Log;
+import org.eclipse.jetty.util.log.StdErrLog;
+import org.eclipse.jetty.util.thread.QueuedThreadPool;
public class JettyHttpServer extends AbstractHttpServer {
@@ -59,7 +59,9 @@ public class JettyHttpServer extends AbstractHttpServer {
threadPool.setMaxThreads(threads);
threadPool.setMinThreads(threads);
- SelectChannelConnector connector = new SelectChannelConnector();
+ server = new Server(threadPool);
+
+ ServerConnector connector = new ServerConnector(server);
String bindIp = url.getParameter(Constants.BIND_IP_KEY, url.getHost());
if (!url.isAnyHost() && NetUtils.isValidLocalHost(bindIp)) {
@@ -67,8 +69,6 @@ public class JettyHttpServer extends AbstractHttpServer {
}
connector.setPort(url.getParameter(Constants.BIND_PORT_KEY, url.getPort()));
- server = new Server();
- server.setThreadPool(threadPool);
server.addConnector(connector);
ServletHandler servletHandler = new ServletHandler();
@@ -76,9 +76,9 @@ public class JettyHttpServer extends AbstractHttpServer {
servletHolder.setInitOrder(2);
// dubbo's original impl can't support the use of ServletContext
-// server.addHandler(servletHandler);
- // TODO Context.SESSIONS is the best option here?
- Context context = new Context(server, "/", Context.SESSIONS);
+ // server.addHandler(servletHandler);
+ // TODO Context.SESSIONS is the best option here? (In jetty 9.x, it becomes ServletContextHandler.SESSIONS)
+ ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
context.setServletHandler(servletHandler);
ServletManager.getInstance().addServletContext(url.getParameter(Constants.BIND_PORT_KEY, url.getPort()), context.getServletContext());
@@ -86,7 +86,7 @@ public class JettyHttpServer extends AbstractHttpServer {
server.start();
} catch (Exception e) {
throw new IllegalStateException("Failed to start jetty server on " + url.getParameter(Constants.BIND_IP_KEY) + ":" + url.getParameter(Constants.BIND_PORT_KEY) + ", cause: "
- + e.getMessage(), e);
+ + e.getMessage(), e);
}
}
diff --git a/dubbo-rpc/dubbo-rpc-dubbo/pom.xml b/dubbo-rpc/dubbo-rpc-dubbo/pom.xml
index af92898..26915e4 100644
--- a/dubbo-rpc/dubbo-rpc-dubbo/pom.xml
+++ b/dubbo-rpc/dubbo-rpc-dubbo/pom.xml
@@ -45,8 +45,12 @@
<version>${project.parent.version}</version>
<exclusions>
<exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
</exclusion>
</exclusions>
</dependency>
diff --git a/pom.xml b/pom.xml
index edfa07f..16713a8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,8 +45,8 @@
<url>https://github.com/apache/incubator-dubbo</url>
<connection>scm:git:https://github.com/apache/incubator-dubbo.git</connection>
<developerConnection>scm:git:https://github.com/apache/incubator-dubbo.git</developerConnection>
- <tag>HEAD</tag>
- </scm>
+ <tag>HEAD</tag>
+ </scm>
<mailingLists>
<mailingList>
<name>Development List</name>
@@ -116,7 +116,7 @@
<maven_compiler_version>3.6.0</maven_compiler_version>
<maven_source_version>3.0.1</maven_source_version>
<maven_javadoc_version>3.0.1</maven_javadoc_version>
- <maven_jetty_version>6.1.26</maven_jetty_version>
+ <maven_jetty_version>9.4.11.v20180605</maven_jetty_version>
<maven_checkstyle_version>3.0.0</maven_checkstyle_version>
<maven_jacoco_version>0.8.1</maven_jacoco_version>
<apache-rat-plugin.version>0.12</apache-rat-plugin.version>
@@ -610,8 +610,8 @@
</configuration>
</plugin>
<plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty-plugin</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-maven-plugin</artifactId>
<version>${maven_jetty_version}</version>
</plugin>
</plugins>