summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2013-03-26 15:43:46 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2013-03-26 15:51:41 +0100
commit2d1eedc2436244b879cba423a42a4fc2c57f7468 (patch)
tree46cdbf32b49219464f8d2447877bc57313d7f816
parentea669e56c1939f38d001fa74a7378117a948e786 (diff)
downloadsonarqube-2d1eedc2436244b879cba423a42a4fc2c57f7468.tar.gz
sonarqube-2d1eedc2436244b879cba423a42a4fc2c57f7468.zip
SONAR-4157 Upgrade the embedded Jetty to version 8.1
-rw-r--r--pom.xml4
-rw-r--r--sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java24
-rw-r--r--sonar-ws-client/pom.xml5
-rw-r--r--sonar-ws-client/src/test/java/org/sonar/wsclient/SonarTest.java15
4 files changed, 30 insertions, 18 deletions
diff --git a/pom.xml b/pom.xml
index 2f233609a5d..df4d49b726f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1029,8 +1029,8 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-servlet-tester</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>test-jetty-servlet</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
diff --git a/sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java b/sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java
index b6ca00e5c1f..6774d34cafa 100644
--- a/sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java
+++ b/sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java
@@ -81,21 +81,29 @@ public class JettyEmbedder {
private Server configureProgrammatically() throws URISyntaxException {
configureServer();
- HandlerCollection handlers = new HandlerCollection();
- WebAppContext context = new WebAppContext(getPath("/war/sonar-server"), contextPath);
- String filenamePattern = configuration.getProperty("sonar.web.jettyRequestLogs");
- RequestLogHandler requestLogHandler = configureRequestLogHandler(filenamePattern);
+
+ List<Handler> handlers = new ArrayList<Handler>();
+
String shutdownCookie = System.getProperty("sonar.shutdownToken");
if (shutdownCookie != null && !"".equals(shutdownCookie)) {
System.out.println("Registering shutdown handler");
ShutdownHandler shutdownHandler = new ShutdownHandler(server, shutdownCookie);
shutdownHandler.setExitJvm(true);
- handlers.setHandlers(new Handler[] {shutdownHandler, context, requestLogHandler});
+ handlers.add(shutdownHandler);
}
- else {
- handlers.setHandlers(new Handler[] {context, requestLogHandler});
+
+ WebAppContext context = new WebAppContext(getPath("/war/sonar-server"), contextPath);
+ handlers.add(context);
+
+ String filenamePattern = configuration.getProperty("sonar.web.jettyRequestLogs");
+ if (filenamePattern != null) {
+ handlers.add(configureRequestLogHandler(filenamePattern));
}
- server.setHandler(handlers);
+
+ HandlerCollection handler = new HandlerCollection();
+ handler.setHandlers(handlers.toArray(new Handler[handlers.size()]));
+ server.setHandler(handler);
+
return server;
}
diff --git a/sonar-ws-client/pom.xml b/sonar-ws-client/pom.xml
index 06e24d43d77..e0b7dc6febb 100644
--- a/sonar-ws-client/pom.xml
+++ b/sonar-ws-client/pom.xml
@@ -72,9 +72,8 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-servlet-tester</artifactId>
- <version>6.1.6</version>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>test-jetty-servlet</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarTest.java
index 49ce5918fef..36d55ec09b1 100644
--- a/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarTest.java
+++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarTest.java
@@ -19,15 +19,20 @@
*/
package org.sonar.wsclient;
+import org.eclipse.jetty.testing.ServletTester;
import org.junit.AfterClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
-import org.mortbay.jetty.testing.ServletTester;
import org.sonar.wsclient.connectors.ConnectionException;
import org.sonar.wsclient.connectors.HttpClient3Connector;
import org.sonar.wsclient.connectors.HttpClient4Connector;
-import org.sonar.wsclient.services.*;
+import org.sonar.wsclient.services.Metric;
+import org.sonar.wsclient.services.MetricQuery;
+import org.sonar.wsclient.services.Query;
+import org.sonar.wsclient.services.RuleQuery;
+import org.sonar.wsclient.services.Server;
+import org.sonar.wsclient.services.ServerQuery;
import org.sonar.wsclient.unmarshallers.UnmarshalException;
import java.util.Arrays;
@@ -68,9 +73,9 @@ public class SonarTest {
baseUrl = tester.createSocketConnector(true);
tester.start();
- return Arrays.asList(new Object[][]{
- {new Sonar(new HttpClient4Connector(new Host(baseUrl)))},
- {new Sonar(new HttpClient3Connector(new Host(baseUrl)))}
+ return Arrays.asList(new Object[][] {
+ {new Sonar(new HttpClient4Connector(new Host(baseUrl)))},
+ {new Sonar(new HttpClient3Connector(new Host(baseUrl)))}
});
}