]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3180 Remove the support of AJP connector
authorSimon Brandhof <simon.brandhof@gmail.com>
Wed, 18 Jan 2012 17:06:36 +0000 (18:06 +0100)
committerSimon Brandhof <simon.brandhof@gmail.com>
Wed, 18 Jan 2012 17:07:56 +0000 (18:07 +0100)
pom.xml
sonar-application/pom.xml
sonar-application/src/main/assembly/conf/sonar.properties
sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java
sonar-application/src/main/java/org/sonar/application/StartServer.java
sonar-application/src/test/java/org/sonar/application/JettyEmbedderTest.java

diff --git a/pom.xml b/pom.xml
index 3993aeece9e4701da8706521af5a31e030d8f82d..5ef077289b40c6699c8b8940a4838548020e1021 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -81,9 +81,7 @@
     -->
     <derby.version>10.7.1.1</derby.version>
 
-    <!-- Do not upgrade to v.6.1.26. AJP connections are broken. See http://jira.codehaus.org/browse/SONAR-3058 -->
     <jetty.version>6.1.25</jetty.version>
-
     <sonar.skippedModules>sonar-deprecated,sonar-gwt-api,sonar-core-gwt,sonar-testing-harness,sonar-samples
     </sonar.skippedModules>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <artifactId>stax2-api</artifactId>
         <version>3.0.1</version>
       </dependency>
-      <dependency>
-        <groupId>org.mortbay.jetty</groupId>
-        <artifactId>jetty-ajp</artifactId>
-        <version>${jetty.version}</version>
-      </dependency>
       <dependency>
         <groupId>org.mortbay.jetty</groupId>
         <artifactId>jetty-plus</artifactId>
index aeee33634ab168dfd904c17506c36b5c70d5168a..c790fecd41ef4f1561bd46cfe60d109c666276f4 100644 (file)
       <artifactId>jtds</artifactId>
       <scope>runtime</scope>
     </dependency>
-    <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty-ajp</artifactId>
-    </dependency>
 
     <!-- core plugins -->
     <dependency>
index 18601529886c5602ebc1402d52587710c6939d2a..c4f3c7b1d8f982c0d0a08311b36a6f4fd8b29da9 100644 (file)
 # Log HTTP requests. Deactivated by default.
 #sonar.web.jettyRequestLogs: ../../logs/jetty-yyyy_mm_dd.request.log
 
-# Apache mod_jk connector. Supported only in standalone mode.
-# Uncomment to activate AJP13 connector.
-#sonar.ajp13.host: 0.0.0.0
-#sonar.ajp13.port: 8009
-
-
 #-----------------------------------------------------------------------
 # DATABASE
 #
index 9660553ec65d1e45c7deeb3c979ec65269e5a5df..2bbbbd276e7b33c4c67a5189494495acbd09b211 100644 (file)
 package org.sonar.application;
 
 import org.apache.commons.io.FileUtils;
-import org.mortbay.jetty.Connector;
 import org.mortbay.jetty.NCSARequestLog;
 import org.mortbay.jetty.Server;
-import org.mortbay.jetty.ajp.Ajp13SocketConnector;
 import org.mortbay.jetty.handler.RequestLogHandler;
 import org.mortbay.jetty.nio.SelectChannelConnector;
 import org.mortbay.jetty.webapp.WebAppContext;
@@ -44,15 +42,11 @@ public class JettyEmbedder {
   private final String host;
   private final int port;
   private final String contextPath;
-  private final String ajp13Host;
-  private final int ajp13Port;
 
-  public JettyEmbedder(String host, int port, String contextPath, String ajp13Host, int ajp13Port, URL configurationURL) throws Exception {
+  public JettyEmbedder(String host, int port, String contextPath, URL configurationURL) throws Exception {
     this.host = host.trim();
     this.port = port;
     this.contextPath = contextPath;
-    this.ajp13Host = ajp13Host;
-    this.ajp13Port = ajp13Port;
     server = new Server();
 
     if (configurationURL == null) {
@@ -62,10 +56,6 @@ public class JettyEmbedder {
       System.setProperty("jetty.host", this.host);
       System.setProperty("jetty.port", String.valueOf(port));
       System.setProperty("jetty.context", contextPath);
-      if (ajp13Port > 0) {
-        System.setProperty("jetty.ajp13Host", this.ajp13Host);
-        System.setProperty("jetty.ajp13Port", String.valueOf(ajp13Port));
-      }
       XmlConfiguration configuration = new XmlConfiguration(configurationURL);
       configuration.configure(server);
     }
@@ -75,7 +65,7 @@ public class JettyEmbedder {
    * for tests
    */
   JettyEmbedder(String host, int port) throws Exception {
-    this(host, port, null, null, 0, null);
+    this(host, port, null, null);
   }
 
   public void start() throws Exception {
@@ -124,13 +114,6 @@ public class JettyEmbedder {
     connector.setStatsOn(false);
     connector.setAcceptors(2);
     connector.setConfidentialPort(8443);
-    if (ajp13Port > 0) {
-      System.out.println("AJP13 connector is on " + ajp13Host + ":" + ajp13Port);
-      Connector ajpConnector = new Ajp13SocketConnector();
-      ajpConnector.setHost(ajp13Host);
-      ajpConnector.setPort(ajp13Port);
-      server.addConnector(ajpConnector);
-    }
     server.addConnector(connector);
     server.setStopAtShutdown(true);
     server.setSendServerVersion(false);
index 2d67cc726884984e472df34b992e3c8a288ba8e3..8c2f48181b0a52e0db87deedaf328f806f50ae21 100644 (file)
@@ -30,8 +30,6 @@ public final class StartServer {
   private static final String DEFAULT_WEB_HOST = "0.0.0.0";
   private static final int DEFAULT_WEB_PORT = 9000;
   private static final String DEFAULT_WEB_CONTEXT = "/";
-  private static final String DEFAULT_AJP13_HOST = "0.0.0.0";
-  private static final int DEFAULT_AJP13_PORT = -1;
 
   private StartServer() {
   }
@@ -44,9 +42,7 @@ public final class StartServer {
     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);
-    String ajp13Host = configuration.getProperty("sonar.ajp13.host", DEFAULT_AJP13_HOST);
-    int ajp13Port = Integer.parseInt(configuration.getProperty("sonar.ajp13.port", "" + DEFAULT_AJP13_PORT));
-    JettyEmbedder jetty = new JettyEmbedder(host, port, context, ajp13Host, ajp13Port, StartServer.class.getResource("/jetty.xml"));
+    JettyEmbedder jetty = new JettyEmbedder(host, port, context, StartServer.class.getResource("/jetty.xml"));
     configureRequestLogs(jetty, configuration);
 
     jetty.start();
@@ -83,6 +79,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());
+      confFile.getParentFile().getParentFile().getAbsolutePath());
   }
 }
index 91150b888b85f77486240a9c96227a6aecfcdbae..9e79ce86f194c68dafcdcfc360e22377e63bcb13 100644 (file)
@@ -30,13 +30,10 @@ 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, "/", "127.0.0.2", 10000,
-        JettyEmbedderTest.class.getResource("/org/sonar/application/jetty-test.xml"));
+    new JettyEmbedder("127.0.0.1", 9999, "/", JettyEmbedderTest.class.getResource("/org/sonar/application/jetty-test.xml"));
     assertEquals("127.0.0.1", System.getProperty("jetty.host"));
     assertEquals("9999", System.getProperty("jetty.port"));
     assertEquals("/", System.getProperty("jetty.context"));
-    assertEquals("127.0.0.2", System.getProperty("jetty.ajp13Host"));
-    assertEquals("10000", System.getProperty("jetty.ajp13Port"));
   }
 
   @Test