aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-application/src
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2014-06-10 13:59:28 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2014-06-10 13:59:28 +0200
commit4fbd4f81c3ec8dd6e0f86a37136eb56b8974ea1c (patch)
tree57b8ecc4b1735df89d4cac72b037b3d12a1f89be /sonar-application/src
parentc83044b1896c686b1d8283877c0414eb20238efb (diff)
downloadsonarqube-4fbd4f81c3ec8dd6e0f86a37136eb56b8974ea1c.tar.gz
sonarqube-4fbd4f81c3ec8dd6e0f86a37136eb56b8974ea1c.zip
Fix documentation of sonar.web.context in conf/sonar.properties
Diffstat (limited to 'sonar-application/src')
-rw-r--r--sonar-application/src/main/assembly/conf/sonar.properties2
-rw-r--r--sonar-application/src/main/java/org/sonar/application/Webapp.java5
-rw-r--r--sonar-application/src/test/java/org/sonar/application/WebappTest.java12
3 files changed, 9 insertions, 10 deletions
diff --git a/sonar-application/src/main/assembly/conf/sonar.properties b/sonar-application/src/main/assembly/conf/sonar.properties
index 65954622bb9..6c058aa3227 100644
--- a/sonar-application/src/main/assembly/conf/sonar.properties
+++ b/sonar-application/src/main/assembly/conf/sonar.properties
@@ -82,7 +82,7 @@ sonar.jdbc.timeBetweenEvictionRunsMillis=30000
# Web context. When set, it must start with forward slash (for example /sonarqube).
# The default value is root context (empty value).
-#sonar.web.context=/
+#sonar.web.context=
# TCP port for incoming HTTP connections. Disabled when value is -1.
#sonar.web.port=9000
diff --git a/sonar-application/src/main/java/org/sonar/application/Webapp.java b/sonar-application/src/main/java/org/sonar/application/Webapp.java
index cda49acd69e..8d5f5a4590a 100644
--- a/sonar-application/src/main/java/org/sonar/application/Webapp.java
+++ b/sonar-application/src/main/java/org/sonar/application/Webapp.java
@@ -32,9 +32,8 @@ class Webapp {
private static final String PROPERTY_LOG_CONSOLE = "sonar.log.console";
static void configure(Tomcat tomcat, Env env, Props props) {
- String ctx = getContext(props);
try {
- Context context = tomcat.addWebapp(ctx, env.file("web").getAbsolutePath());
+ Context context = tomcat.addWebapp(getContextPath(props), env.file("web").getAbsolutePath());
context.setConfigFile(env.file("web/META-INF/context.xml").toURI().toURL());
context.addParameter(PROPERTY_LOG_PROFILING_LEVEL, props.of(PROPERTY_LOG_PROFILING_LEVEL, "NONE"));
context.addParameter(PROPERTY_LOG_CONSOLE, props.of(PROPERTY_LOG_CONSOLE, "false"));
@@ -46,7 +45,7 @@ class Webapp {
}
}
- static String getContext(Props props) {
+ static String getContextPath(Props props) {
String context = props.of(PROPERTY_CONTEXT, "");
if ("/".equals(context)) {
context = "";
diff --git a/sonar-application/src/test/java/org/sonar/application/WebappTest.java b/sonar-application/src/test/java/org/sonar/application/WebappTest.java
index 2ddb47b5460..dc7d605cc68 100644
--- a/sonar-application/src/test/java/org/sonar/application/WebappTest.java
+++ b/sonar-application/src/test/java/org/sonar/application/WebappTest.java
@@ -92,12 +92,12 @@ public class WebappTest {
}
@Test
- public void context_must_start_with_slash() throws Exception {
+ public void context_path_must_start_with_slash() throws Exception {
Properties p = new Properties();
p.setProperty("sonar.web.context", "foo");
try {
- Webapp.getContext(new Props(p));
+ Webapp.getContextPath(new Props(p));
fail();
} catch (IllegalStateException e) {
assertThat(e.getMessage()).isEqualTo("Value of 'sonar.web.context' must start with a forward slash: 'foo'");
@@ -105,16 +105,16 @@ public class WebappTest {
}
@Test
- public void root_context_must_be_blank() throws Exception {
+ public void root_context_path_must_be_blank() throws Exception {
Properties p = new Properties();
p.setProperty("sonar.web.context", "/");
- assertThat(Webapp.getContext(new Props(p))).isEqualTo("");
+ assertThat(Webapp.getContextPath(new Props(p))).isEqualTo("");
}
@Test
- public void default_context_is_root() throws Exception {
- String context = Webapp.getContext(new Props(new Properties()));
+ public void default_context_path_is_root() throws Exception {
+ String context = Webapp.getContextPath(new Props(new Properties()));
assertThat(context).isEqualTo("");
}
}