-->
<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>
<artifactId>jtds</artifactId>
<scope>runtime</scope>
</dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-ajp</artifactId>
- </dependency>
<!-- core plugins -->
<dependency>
# 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
#
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;
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) {
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);
}
* 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 {
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);
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() {
}
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();
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());
}
}
@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