diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2013-03-26 14:43:01 +0100 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2013-03-26 14:43:48 +0100 |
commit | 9d37a7de14a8df7d02879865696510b4ebfaba5c (patch) | |
tree | b2e3056da4f369633ffb488cfb9ebc64bf1f5fe0 | |
parent | ac4d05b40f4667e7c497c37b11808c73536942b8 (diff) | |
download | sonarqube-9d37a7de14a8df7d02879865696510b4ebfaba5c.tar.gz sonarqube-9d37a7de14a8df7d02879865696510b4ebfaba5c.zip |
SONAR-4157 Upgrade the embedded Jetty to version 8.1
-rw-r--r-- | pom.xml | 28 | ||||
-rw-r--r-- | sonar-application/pom.xml | 12 | ||||
-rw-r--r-- | sonar-application/src/main/assembly/conf/sonar.properties | 5 | ||||
-rw-r--r-- | sonar-application/src/main/java/org/sonar/application/FilteredLogger.java | 76 | ||||
-rw-r--r-- | sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java | 48 | ||||
-rw-r--r-- | sonar-application/src/main/java/org/sonar/application/ShutdownHandler.java | 151 | ||||
-rw-r--r-- | sonar-application/src/main/java/org/sonar/application/StartServer.java | 17 | ||||
-rw-r--r-- | sonar-application/src/test/java/org/sonar/application/JettyEmbedderTest.java | 13 | ||||
-rw-r--r-- | sonar-application/src/test/resources/org/sonar/application/jetty-test.xml | 61 | ||||
-rw-r--r-- | sonar-batch/pom.xml | 8 | ||||
-rw-r--r-- | sonar-batch/src/test/java/org/sonar/batch/bootstrap/ServerClientTest.java | 12 | ||||
-rw-r--r-- | sonar-plugin-api/pom.xml | 2 | ||||
-rw-r--r-- | sonar-server/pom.xml | 10 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/web.xml | 9 |
14 files changed, 62 insertions, 390 deletions
@@ -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> @@ -965,33 +965,27 @@ </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> diff --git a/sonar-application/pom.xml b/sonar-application/pom.xml index e93a9714acd..d4b9b9bd9c3 100644 --- a/sonar-application/pom.xml +++ b/sonar-application/pom.xml @@ -22,16 +22,12 @@ <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> diff --git a/sonar-application/src/main/assembly/conf/sonar.properties b/sonar-application/src/main/assembly/conf/sonar.properties index 11f0859b6c6..f5a6e4d08b2 100644 --- a/sonar-application/src/main/assembly/conf/sonar.properties +++ b/sonar-application/src/main/assembly/conf/sonar.properties @@ -24,12 +24,11 @@ #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 index b5c07b996d5..00000000000 --- a/sonar-application/src/main/java/org/sonar/application/FilteredLogger.java +++ /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); - } -} 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 98da317bedf..b6ca00e5c1f 100644 --- a/sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java +++ b/sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java @@ -20,15 +20,15 @@ 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 index 2a184d8ce09..00000000000 --- a/sonar-application/src/main/java/org/sonar/application/ShutdownHandler.java +++ /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,"secret password") }); - 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; - } - -} diff --git a/sonar-application/src/main/java/org/sonar/application/StartServer.java b/sonar-application/src/main/java/org/sonar/application/StartServer.java index 68816d8237d..590cce20956 100644 --- a/sonar-application/src/main/java/org/sonar/application/StartServer.java +++ b/sonar-application/src/main/java/org/sonar/application/StartServer.java @@ -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()); } } diff --git a/sonar-application/src/test/java/org/sonar/application/JettyEmbedderTest.java b/sonar-application/src/test/java/org/sonar/application/JettyEmbedderTest.java index 1804d4cd4ff..188ab357023 100644 --- a/sonar-application/src/test/java/org/sonar/application/JettyEmbedderTest.java +++ b/sonar-application/src/test/java/org/sonar/application/JettyEmbedderTest.java @@ -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 index 66b888778e6..00000000000 --- a/sonar-application/src/test/resources/org/sonar/application/jetty-test.xml +++ /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> diff --git a/sonar-batch/pom.xml b/sonar-batch/pom.xml index 9ce759ab34c..d1b299715a0 100644 --- a/sonar-batch/pom.xml +++ b/sonar-batch/pom.xml @@ -60,6 +60,10 @@ <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> </dependency> @@ -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> diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ServerClientTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ServerClientTest.java index 1ac83ef89db..76a7d09a934 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ServerClientTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ServerClientTest.java @@ -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); diff --git a/sonar-plugin-api/pom.xml b/sonar-plugin-api/pom.xml index 4c175261a50..69529e7a48a 100644 --- a/sonar-plugin-api/pom.xml +++ b/sonar-plugin-api/pom.xml @@ -127,7 +127,7 @@ </dependency> <dependency> <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> + <artifactId>javax.servlet-api</artifactId> <optional>true</optional> </dependency> diff --git a/sonar-server/pom.xml b/sonar-server/pom.xml index 1d1c513563a..62d8d60b14b 100644 --- a/sonar-server/pom.xml +++ b/sonar-server/pom.xml @@ -111,7 +111,7 @@ </dependency> <dependency> <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> + <artifactId>javax.servlet-api</artifactId> <scope>provided</scope> </dependency> <dependency> @@ -132,8 +132,8 @@ </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 --> @@ -369,9 +369,9 @@ </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> diff --git a/sonar-server/src/main/webapp/WEB-INF/web.xml b/sonar-server/src/main/webapp/WEB-INF/web.xml index 47c60f5ff48..e154cf32012 100644 --- a/sonar-server/src/main/webapp/WEB-INF/web.xml +++ b/sonar-server/src/main/webapp/WEB-INF/web.xml @@ -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> |