SONAR-4157 Upgrade the embedded Jetty to version 8.1

This commit is contained in:
Julien HENRY 2013-03-26 15:43:46 +01:00
parent ea669e56c1
commit 2d1eedc243
4 changed files with 30 additions and 18 deletions

View File

@ -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>

View File

@ -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;
}

View File

@ -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>

View File

@ -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)))}
});
}