]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4157 Upgrade the embedded Jetty to version 8.1
authorJulien HENRY <julien.henry@sonarsource.com>
Tue, 26 Mar 2013 13:43:01 +0000 (14:43 +0100)
committerJulien HENRY <julien.henry@sonarsource.com>
Tue, 26 Mar 2013 13:43:48 +0000 (14:43 +0100)
14 files changed:
pom.xml
sonar-application/pom.xml
sonar-application/src/main/assembly/conf/sonar.properties
sonar-application/src/main/java/org/sonar/application/FilteredLogger.java [deleted file]
sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java
sonar-application/src/main/java/org/sonar/application/ShutdownHandler.java [deleted file]
sonar-application/src/main/java/org/sonar/application/StartServer.java
sonar-application/src/test/java/org/sonar/application/JettyEmbedderTest.java
sonar-application/src/test/resources/org/sonar/application/jetty-test.xml [deleted file]
sonar-batch/pom.xml
sonar-batch/src/test/java/org/sonar/batch/bootstrap/ServerClientTest.java
sonar-plugin-api/pom.xml
sonar-server/pom.xml
sonar-server/src/main/webapp/WEB-INF/web.xml

diff --git a/pom.xml b/pom.xml
index 5fb410737f77f63fdc0913c911630339e1d5b8bf..2f233609a5d46561876ad738cfacc7c533e855ed 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -74,7 +74,7 @@
     <sonarJava.version>1.3-SNAPSHOT</sonarJava.version>
     <sonarGwt.version>3.3.1</sonarGwt.version>
     <h2.version>1.3.167</h2.version>
-    <jetty.version>6.1.25</jetty.version>
+    <jetty.version>8.1.9.v20130131</jetty.version>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <maven.min.version>2.2.1</maven.min.version>
     <jdk.min.version>1.6</jdk.min.version>
       </dependency>
       <dependency>
         <groupId>javax.servlet</groupId>
-        <artifactId>servlet-api</artifactId>
-        <version>2.5</version>
+        <artifactId>javax.servlet-api</artifactId>
+        <version>3.0.1</version>
       </dependency>
       <dependency>
-        <groupId>org.mortbay.jetty</groupId>
-        <artifactId>jetty-plus</artifactId>
+        <groupId>org.eclipse.jetty</groupId>
+        <artifactId>jetty-server</artifactId>
         <version>${jetty.version}</version>
       </dependency>
       <dependency>
-        <groupId>org.mortbay.jetty</groupId>
-        <artifactId>jetty-naming</artifactId>
+        <groupId>org.eclipse.jetty</groupId>
+        <artifactId>jetty-webapp</artifactId>
         <version>${jetty.version}</version>
-        <exclusions>
-          <exclusion>
-            <groupId>javax.mail</groupId>
-            <artifactId>mail</artifactId>
-          </exclusion>
-        </exclusions>
       </dependency>
       <dependency>
-        <groupId>org.mortbay.jetty</groupId>
-        <artifactId>jetty</artifactId>
+        <groupId>org.eclipse.jetty</groupId>
+        <artifactId>jetty-util</artifactId>
         <version>${jetty.version}</version>
       </dependency>
       <dependency>
-        <groupId>org.mortbay.jetty</groupId>
-        <artifactId>jetty-util</artifactId>
+        <groupId>org.eclipse.jetty</groupId>
+        <artifactId>jetty-servlets</artifactId>
         <version>${jetty.version}</version>
       </dependency>
       <dependency>
index e93a9714acddd8800074db9f0a93e4beb9f81942..d4b9b9bd9c3586bc91c811016f01d144acadecd6 100644 (file)
       <type>war</type>
     </dependency>
     <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty-plus</artifactId>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-server</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty-naming</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty</artifactId>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-webapp</artifactId>
     </dependency>
     <dependency>
       <groupId>commons-io</groupId>
index 11f0859b6c602ae46457b014bfba71a3edddfdce..f5a6e4d08b234012a1011f1c493e74c1b2ffdb63 100644 (file)
 #sonar.web.jettyRequestLogs: ../../logs/jetty-yyyy_mm_dd.request.log
 #sonar.web.jetty.threads.min:              5
 #sonar.web.jetty.threads.max:              50
-#sonar.web.jetty.threads.low:              10
 
 #-----------------------------------------------------------------------
 # DATABASE
 #
-# IMPORTANT : the embedded database H2 is used by default. 
+# IMPORTANT : the embedded database H2 is used by default.
 # It is recommended for tests only. Please use an external database
 # for production environment (MySQL, Oracle, Postgresql, SQLServer)
 #
@@ -44,7 +43,7 @@ sonar.jdbc.password:                       sonar
 #----- Embedded database H2
 # Note : it does not accept connections from remote hosts, so the
 # sonar server and the maven plugin must be executed on the same host.
-  
+
 # Comment the following line to deactivate the default embedded database.
 sonar.jdbc.url:                            jdbc:h2:tcp://localhost:9092/sonar
 #sonar.jdbc.driverClassName:                org.h2.Driver
diff --git a/sonar-application/src/main/java/org/sonar/application/FilteredLogger.java b/sonar-application/src/main/java/org/sonar/application/FilteredLogger.java
deleted file mode 100644 (file)
index b5c07b9..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2012 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
- */
-package org.sonar.application;
-
-import org.mortbay.log.Logger;
-import org.mortbay.log.StdErrLog;
-
-public class FilteredLogger implements Logger {
-  private final String name;
-  private final Logger delegate;
-
-  public FilteredLogger() {
-    this(null);
-  }
-
-  private FilteredLogger(String name) {
-    this.name = name;
-    this.delegate = new StdErrLog(name);
-  }
-
-  public boolean isDebugEnabled() {
-    return delegate.isDebugEnabled();
-  }
-
-  public void setDebugEnabled(boolean enabled) {
-    delegate.setDebugEnabled(enabled);
-  }
-
-  public void info(String msg, Object arg0, Object arg1) {
-    if (msg.contains("JVM BUG(s)")) {
-      // Ignore, see SONAR-3866
-      return;
-    }
-    delegate.info(msg, arg0, arg1);
-  }
-
-  public void debug(String msg, Throwable th) {
-    delegate.debug(msg, th);
-  }
-
-  public void debug(String msg, Object arg0, Object arg1) {
-    delegate.debug(msg, arg0, arg1);
-  }
-
-  public void warn(String msg, Object arg0, Object arg1) {
-    delegate.warn(msg, arg0, arg1);
-  }
-
-  public void warn(String msg, Throwable th) {
-    delegate.warn(msg, th);
-  }
-
-  public Logger getLogger(String name) {
-    if ((name == null && this.name == null) || ((name != null) && name.equals(this.name))) {
-      return this;
-    }
-    return new FilteredLogger(name);
-  }
-}
index 98da317bedf9d1d9eff4bed0095b1f2c52dab65b..b6ca00e5c1fbb8345f7d962d655a1a9b68823f34 100644 (file)
 package org.sonar.application;
 
 import org.apache.commons.io.FileUtils;
-import org.mortbay.jetty.Handler;
-import org.mortbay.jetty.NCSARequestLog;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.handler.HandlerList;
-import org.mortbay.jetty.handler.RequestLogHandler;
-import org.mortbay.jetty.nio.SelectChannelConnector;
-import org.mortbay.jetty.webapp.WebAppContext;
-import org.mortbay.thread.QueuedThreadPool;
-import org.mortbay.xml.XmlConfiguration;
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.NCSARequestLog;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.eclipse.jetty.server.handler.RequestLogHandler;
+import org.eclipse.jetty.server.handler.ShutdownHandler;
+import org.eclipse.jetty.server.nio.SelectChannelConnector;
+import org.eclipse.jetty.util.thread.QueuedThreadPool;
+import org.eclipse.jetty.webapp.WebAppContext;
 
 import java.io.File;
 import java.io.IOException;
@@ -47,29 +47,20 @@ public class JettyEmbedder {
   private final String contextPath;
   private final Properties configuration;
 
-  public JettyEmbedder(String host, int port, String contextPath, URL configurationURL, Properties configuration) throws Exception {
+  public JettyEmbedder(String host, int port, String contextPath, Properties configuration) throws Exception {
     this.host = host.trim();
     this.port = port;
     this.contextPath = contextPath;
     this.configuration = configuration;
     server = new Server();
-
-    if (configurationURL == null) {
-      configureProgrammatically();
-    } else {
-      System.setProperty("jetty.host", this.host);
-      System.setProperty("jetty.port", String.valueOf(port));
-      System.setProperty("jetty.context", contextPath);
-      XmlConfiguration xmlConfiguration = new XmlConfiguration(configurationURL);
-      xmlConfiguration.configure(server);
-    }
+    configureProgrammatically();
   }
 
   /**
    * for tests
    */
   JettyEmbedder(String host, int port) throws Exception {
-    this(host, port, null, null, new Properties());
+    this(host, port, null, new Properties());
   }
 
   public void start() throws Exception {
@@ -90,23 +81,25 @@ 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);
     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);
-      HandlerList handlers = new HandlerList();
-      handlers.setHandlers(new Handler[] {shutdownHandler, context});
-      server.setHandler(handlers);
+      handlers.setHandlers(new Handler[] {shutdownHandler, context, requestLogHandler});
     }
     else {
-      server.addHandler(context);
+      handlers.setHandlers(new Handler[] {context, requestLogHandler});
     }
+    server.setHandler(handlers);
     return server;
   }
 
-  public void configureRequestLogs(String filenamePattern) {
+  public RequestLogHandler configureRequestLogHandler(String filenamePattern) {
     RequestLogHandler requestLogHandler = new RequestLogHandler();
     NCSARequestLog requestLog = new NCSARequestLog(filenamePattern);
     requestLog.setRetainDays(7);
@@ -114,14 +107,13 @@ public class JettyEmbedder {
     requestLog.setExtended(true);
     requestLog.setLogTimeZone("GMT");
     requestLogHandler.setRequestLog(requestLog);
-    server.addHandler(requestLogHandler);
+    return requestLogHandler;
   }
 
   private void configureServer() {
     QueuedThreadPool threadPool = new QueuedThreadPool();
     threadPool.setMinThreads(getIntProperty("sonar.web.jetty.threads.min", 5));
     threadPool.setMaxThreads(getIntProperty("sonar.web.jetty.threads.max", 50));
-    threadPool.setLowThreads(getIntProperty("sonar.web.jetty.threads.low", 10));
     server.setThreadPool(threadPool);
     SelectChannelConnector connector = new SelectChannelConnector();
     connector.setHost(host);
diff --git a/sonar-application/src/main/java/org/sonar/application/ShutdownHandler.java b/sonar-application/src/main/java/org/sonar/application/ShutdownHandler.java
deleted file mode 100644 (file)
index 2a184d8..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2012 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
- */
-package org.sonar.application;
-
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.handler.AbstractHandler;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import java.io.IOException;
-
-/* ------------------------------------------------------------ */
-/**
- * TODO Duplicate code from Jetty 8 waiting for upgrade.
- *
- *
- * A handler that shuts the server down on a valid request. Used to do "soft" restarts from Java. If _exitJvm ist set to true a hard System.exit() call is being
- * made.
- *
- * This handler is a contribution from Johannes Brodwall: https://bugs.eclipse.org/bugs/show_bug.cgi?id=357687
- *
- * Usage:
- *
- * <pre>
-    Server server = new Server(8080);
-    HandlerList handlers = new HandlerList();
-    handlers.setHandlers(new Handler[]
-    { someOtherHandler, new ShutdownHandler(server,&quot;secret password&quot;) });
-    server.setHandler(handlers);
-    server.start();
-   </pre>
- *
-   <pre>
-   public static void attemptShutdown(int port, String shutdownCookie) {
-        try {
-            URL url = new URL("http://localhost:" + port + "/shutdown?token=" + shutdownCookie);
-            HttpURLConnection connection = (HttpURLConnection)url.openConnection();
-            connection.setRequestMethod("POST");
-            connection.getResponseCode();
-            logger.info("Shutting down " + url + ": " + connection.getResponseMessage());
-        } catch (SocketException e) {
-            logger.debug("Not running");
-            // Okay - the server is not running
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-    }
-  </pre>
- */
-public class ShutdownHandler extends AbstractHandler {
-
-  private final String _shutdownToken;
-
-  private final Server _server;
-
-  private boolean _exitJvm = false;
-
-  /**
-   * Creates a listener that lets the server be shut down remotely (but only from localhost).
-   *
-   * @param server
-   *            the Jetty instance that should be shut down
-   * @param shutdownToken
-   *            a secret password to avoid unauthorized shutdown attempts
-   */
-  public ShutdownHandler(Server server, String shutdownToken) {
-    this._server = server;
-    this._shutdownToken = shutdownToken;
-  }
-
-  public void handle(String target, HttpServletRequest request, HttpServletResponse response,
-      int dispatch) throws IOException, ServletException {
-    if (!target.equals("/shutdown")) {
-      return;
-    }
-
-    if (!request.getMethod().equals("POST")) {
-      response.sendError(HttpServletResponse.SC_BAD_REQUEST);
-      return;
-    }
-    if (!hasCorrectSecurityToken(request)) {
-      System.err.println("Unauthorized shutdown attempt from " + getRemoteAddr(request));
-      response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
-      return;
-    }
-    if (!requestFromLocalhost(request)) {
-      System.err.println("Unauthorized shutdown attempt from " + getRemoteAddr(request));
-      response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
-      return;
-    }
-
-    System.out.println("Shutting down by request from " + getRemoteAddr(request));
-
-    new Thread() {
-      public void run() {
-        try {
-          shutdownServer();
-        } catch (InterruptedException e) {
-          // Ignored
-        } catch (Exception e) {
-          throw new RuntimeException("Shutting down server", e);
-        }
-      }
-    }.start();
-  }
-
-  private boolean requestFromLocalhost(HttpServletRequest request) {
-    return "127.0.0.1".equals(getRemoteAddr(request));
-  }
-
-  protected String getRemoteAddr(HttpServletRequest request) {
-    return request.getRemoteAddr();
-  }
-
-  private boolean hasCorrectSecurityToken(HttpServletRequest request) {
-    return _shutdownToken.equals(request.getParameter("token"));
-  }
-
-  private void shutdownServer() throws Exception {
-    _server.stop();
-
-    if (_exitJvm)
-    {
-      System.exit(0);
-    }
-  }
-
-  public void setExitJvm(boolean exitJvm) {
-    this._exitJvm = exitJvm;
-  }
-
-}
index 68816d8237dfecb1de7e56c7a8ce40812e6f6ae2..590cce209569a28023e4c35280dee6cb9c58040a 100644 (file)
@@ -37,14 +37,12 @@ public final class StartServer {
   public static void main(String[] args) throws Exception {
     canCreateTemporaryFiles();
     configureHome();
-    configureJettyLogger();
 
     Properties configuration = getConfiguration();
     String host = configuration.getProperty("sonar.web.host", DEFAULT_WEB_HOST);
     int port = Integer.parseInt(configuration.getProperty("sonar.web.port", "" + DEFAULT_WEB_PORT));
     String context = configuration.getProperty("sonar.web.context", DEFAULT_WEB_CONTEXT);
-    JettyEmbedder jetty = new JettyEmbedder(host, port, context, StartServer.class.getResource("/jetty.xml"), configuration);
-    configureRequestLogs(jetty, configuration);
+    JettyEmbedder jetty = new JettyEmbedder(host, port, context, configuration);
 
     jetty.start();
     Thread.currentThread().join();
@@ -64,13 +62,6 @@ public final class StartServer {
     }
   }
 
-  private static void configureRequestLogs(JettyEmbedder jetty, Properties configuration) {
-    String filenamePattern = configuration.getProperty("sonar.web.jettyRequestLogs");
-    if (filenamePattern != null) {
-      jetty.configureRequestLogs(filenamePattern);
-    }
-  }
-
   private static Properties getConfiguration() throws IOException {
     Properties properties = new Properties();
     properties.load(StartServer.class.getResourceAsStream("/conf/sonar.properties"));
@@ -80,10 +71,6 @@ public final class StartServer {
   private static void configureHome() throws URISyntaxException {
     File confFile = new File(StartServer.class.getResource("/conf/sonar.properties").toURI());
     System.setProperty("SONAR_HOME" /* see constant org.sonar.server.platform.SonarHome.PROPERTY */,
-      confFile.getParentFile().getParentFile().getAbsolutePath());
-  }
-
-  private static void configureJettyLogger() {
-    System.setProperty("org.mortbay.log.class", FilteredLogger.class.getName());
+        confFile.getParentFile().getParentFile().getAbsolutePath());
   }
 }
index 1804d4cd4fff7bfd9a472cfb64eaaac0f001f896..188ab3570232ffcabce81e96642f9ab16414623b 100644 (file)
@@ -22,23 +22,12 @@ package org.sonar.application;
 import org.apache.commons.lang.StringUtils;
 import org.junit.Test;
 
-import java.util.Properties;
-
 import static org.fest.assertions.Assertions.assertThat;
 
 public class JettyEmbedderTest {
-  @Test
-  public void xmlConfigurationShouldAccessToSomeSystemProperties() throws Exception {
-    // useful to set the port into the XML file
-    new JettyEmbedder("127.0.0.1", 9999, "/", JettyEmbedderTest.class.getResource("/org/sonar/application/jetty-test.xml"), new Properties());
-
-    assertThat(System.getProperty("jetty.host")).isEqualTo("127.0.0.1");
-    assertThat(System.getProperty("jetty.port")).isEqualTo("9999");
-    assertThat(System.getProperty("jetty.context")).isEqualTo("/");
-  }
 
   @Test
-  public void shouldUseDefaultConfigurationIfNoXml() throws Exception {
+  public void shouldConfigureProgrammatically() throws Exception {
     JettyEmbedder jetty = new JettyEmbedder("1.2.3.4", 9999);
 
     assertThat(jetty.getServer().getConnectors()).hasSize(1);
diff --git a/sonar-application/src/test/resources/org/sonar/application/jetty-test.xml b/sonar-application/src/test/resources/org/sonar/application/jetty-test.xml
deleted file mode 100644 (file)
index 66b8887..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
-
-<!-- =============================================================== -->
-<!-- Configure the Jetty Server                                      -->
-<!--                                                                 -->
-<!-- Documentation of this file format can be found at:              -->
-<!-- http://docs.codehaus.org/display/JETTY/jetty.xml                -->
-<!--                                                                 -->
-<!-- =============================================================== -->
-
-
-<Configure id="Server" class="org.mortbay.jetty.Server">
-
-    <!-- =========================================================== -->
-    <!-- Server Thread Pool                                          -->
-    <!-- =========================================================== -->
-    <Set name="ThreadPool">
-      <!-- Default bounded blocking threadpool 
-      -->
-      <New class="org.mortbay.thread.BoundedThreadPool">
-        <Set name="minThreads">5</Set>
-        <Set name="maxThreads">50</Set>
-        <Set name="lowThreads">10</Set>
-      </New>
-
-    </Set>
-
-    <!-- =========================================================== -->
-    <!-- Set connectors                                              -->
-    <!-- =========================================================== -->
-    <!-- One of each type!                                           -->
-    <!-- =========================================================== -->
-
-    <!-- Use this connector for many frequently idle connections
-         and for threadless continuations.
-    -->
-    <Call name="addConnector">
-      <Arg>
-          <New class="org.mortbay.jetty.nio.SelectChannelConnector">
-            <Set name="host"><SystemProperty name="jetty.host" default="0.0.0.0"/></Set>
-            <Set name="port"><SystemProperty name="jetty.port" default="9000"/></Set>
-            <Set name="maxIdleTime">30000</Set>
-            <Set name="Acceptors">2</Set>
-            <Set name="statsOn">false</Set>
-            <Set name="confidentialPort">8443</Set>
-            <Set name="lowResourcesConnections">5000</Set>
-            <Set name="lowResourcesMaxIdleTime">5000</Set>
-          </New>
-      </Arg>
-    </Call>
-
-    <!-- =========================================================== -->
-    <!-- extra options                                               -->
-    <!-- =========================================================== -->
-    <Set name="stopAtShutdown">true</Set>
-    <Set name="sendServerVersion">true</Set>
-    <Set name="sendDateHeader">true</Set>
-    <Set name="gracefulShutdown">1000</Set>
-
-</Configure>
index 9ce759ab34c97057cb6b83fd19622b2eab38b689..d1b299715a0f55f9ef9c8dfe2c30b2f02c89c71a 100644 (file)
       <groupId>commons-lang</groupId>
       <artifactId>commons-lang</artifactId>
     </dependency>
+    <dependency>
+      <groupId>commons-configuration</groupId>
+      <artifactId>commons-configuration</artifactId>
+    </dependency>
     <dependency>
       <groupId>com.google.code.gson</groupId>
       <artifactId>gson</artifactId>
@@ -81,8 +85,8 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty</artifactId>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-server</artifactId>
       <scope>test</scope>
     </dependency>
   </dependencies>
index 1ac83ef89dbfdbb74feafcecc71c68cc77c52a7a..76a7d09a934add415618bf1dccdcddbc06c6e7e0 100644 (file)
@@ -22,16 +22,15 @@ package org.sonar.batch.bootstrap;
 import com.google.common.base.Charsets;
 import com.google.common.io.Files;
 import org.apache.commons.io.IOUtils;
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.AbstractHandler;
 import org.junit.After;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.junit.rules.TemporaryFolder;
-import org.mortbay.jetty.Handler;
-import org.mortbay.jetty.HttpConnection;
-import org.mortbay.jetty.Request;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.handler.AbstractHandler;
 import org.sonar.batch.bootstrapper.EnvironmentInformation;
 
 import javax.servlet.ServletException;
@@ -165,8 +164,7 @@ public class ServerClientTest {
     public Handler getMockHandler() {
       Handler handler = new AbstractHandler() {
 
-        public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException {
-          Request baseRequest = request instanceof Request ? (Request) request : HttpConnection.getCurrentConnection().getRequest();
+        public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
           setResponseBody(getMockResponseData());
           setRequestBody(IOUtils.toString(baseRequest.getInputStream()));
           response.setStatus(mockResponseStatus);
index 4c175261a50de7afc50d815ef9584ea9c9d78e97..69529e7a48aa109d93539962c11789f9abdd81ed 100644 (file)
     </dependency>
     <dependency>
       <groupId>javax.servlet</groupId>
-      <artifactId>servlet-api</artifactId>
+      <artifactId>javax.servlet-api</artifactId>
       <optional>true</optional>
     </dependency>
 
index 1d1c513563a82d06fa0832a02f907c04ff8057ae..62d8d60b14b791a8c993dfb7454712b368c5b1b9 100644 (file)
     </dependency>
     <dependency>
       <groupId>javax.servlet</groupId>
-      <artifactId>servlet-api</artifactId>
+      <artifactId>javax.servlet-api</artifactId>
       <scope>provided</scope>
     </dependency>
     <dependency>
     </dependency>
     <dependency>
       <!-- GZIP filter -->
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty-util</artifactId>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-servlets</artifactId>
     </dependency>
 
     <!-- unit tests -->
             </executions>
           </plugin>
           <plugin>
-            <groupId>org.mortbay.jetty</groupId>
+            <groupId>org.eclipse.jetty</groupId>
             <artifactId>jetty-maven-plugin</artifactId>
-            <version>7.1.0.v20100505</version>
+            <version>${jetty.version}</version>
             <configuration>
               <webAppConfig>
                 <contextPath>/dev</contextPath>
index 47c60f5ff481fee0debce19eee5710c040ab2e7c..e154cf3201251986627547863162c9dbce7d69cc 100644 (file)
@@ -1,8 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
-         version="2.4">
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         metadata-complete="true"
+         version="3.0">
 
   <display-name>Sonar</display-name>
 
@@ -45,7 +46,7 @@
   </filter>
   <filter>
     <filter-name>GZIPFilter</filter-name>
-    <filter-class>org.mortbay.servlet.GzipFilter</filter-class>
+    <filter-class>org.eclipse.jetty.servlets.GzipFilter</filter-class>
     <init-param>
       <param-name>minGzipSize</param-name>
       <param-value>1024</param-value>