Issue #1505 remove trailing / from jetty.home.uri
This commit is contained in:
parent
06f721e3c2
commit
04019675f6
|
@ -605,13 +605,20 @@ public class DeploymentManager extends ContainerLifeCycle
|
|||
xmlc.getIdMap().put("Server", getServer());
|
||||
Resource home = Resource.newResource(System.getProperty("jetty.home","."));
|
||||
xmlc.getProperties().put("jetty.home",home.toString());
|
||||
xmlc.getProperties().put("jetty.home.uri",home.getURI().toString());
|
||||
xmlc.getProperties().put("jetty.home.uri",normalizeURI(home.getURI().toString()));
|
||||
|
||||
Resource base = Resource.newResource(System.getProperty("jetty.base",home.toString()));
|
||||
xmlc.getProperties().put("jetty.base",base.toString());
|
||||
xmlc.getProperties().put("jetty.base.uri",base.getURI().toString());
|
||||
xmlc.getProperties().put("jetty.base.uri",normalizeURI(base.getURI().toString()));
|
||||
|
||||
xmlc.getProperties().put("jetty.webapp",webapp.toString());
|
||||
xmlc.getProperties().put("jetty.webapps",webapp.getFile().toPath().getParent().toString());
|
||||
}
|
||||
|
||||
private String normalizeURI(String uri)
|
||||
{
|
||||
if (uri.endsWith("/"))
|
||||
return uri.substring(0,uri.length()-1);
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -299,13 +299,13 @@ public class Main
|
|||
if (!args.getProperties().containsKey(BaseHome.JETTY_HOME))
|
||||
args.getProperties().setProperty(home);
|
||||
args.getProperties().setProperty(BaseHome.JETTY_HOME+".uri",
|
||||
baseHome.getHomePath().toUri().toString(),
|
||||
normalizeURI(baseHome.getHomePath().toUri().toString()),
|
||||
home.origin);
|
||||
Props.Prop base = props.getProp(BaseHome.JETTY_BASE);
|
||||
if (!args.getProperties().containsKey(BaseHome.JETTY_BASE))
|
||||
args.getProperties().setProperty(base);
|
||||
args.getProperties().setProperty(BaseHome.JETTY_BASE+".uri",
|
||||
baseHome.getBasePath().toUri().toString(),
|
||||
normalizeURI(baseHome.getBasePath().toUri().toString()),
|
||||
base.origin);
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
@ -362,6 +362,13 @@ public class Main
|
|||
return args;
|
||||
}
|
||||
|
||||
private String normalizeURI(String uri)
|
||||
{
|
||||
if (uri.endsWith("/"))
|
||||
return uri.substring(0,uri.length()-1);
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void start(StartArgs args) throws IOException, InterruptedException
|
||||
{
|
||||
StartLog.debug("StartArgs: %s",args);
|
||||
|
|
|
@ -70,9 +70,9 @@ public class MainTest
|
|||
// baseHome.getConfigSources().getProps().forEach(p->System.err.println(p));
|
||||
|
||||
assertThat(args.getProperties().getString("jetty.home"),is(baseHome.getHome()));
|
||||
assertThat(args.getProperties().getString("jetty.home.uri"),is(baseHome.getHomePath().toUri().toString()));
|
||||
assertThat(args.getProperties().getString("jetty.home.uri")+"/",is(baseHome.getHomePath().toUri().toString()));
|
||||
assertThat(args.getProperties().getString("jetty.base"),is(baseHome.getBase()));
|
||||
assertThat(args.getProperties().getString("jetty.base.uri"),is(baseHome.getBasePath().toUri().toString()));
|
||||
assertThat(args.getProperties().getString("jetty.base.uri")+"/",is(baseHome.getBasePath().toUri().toString()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue