Skip to content

Commit

Permalink
Issue #3399 jetty.webapps.uri should be the parent of the webapp
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Bartel <janb@webtide.com>
  • Loading branch information
janbartel committed Mar 6, 2019
1 parent c63a578 commit 0074c00
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void setJettyStandardIdsAndProperties(Object server, Resource webapp)
Path webappPath = webapp.getFile().toPath().toAbsolutePath();
getProperties().put("jetty.webapp", webappPath.toString());
getProperties().put("jetty.webapps", webappPath.getParent().toString());
getProperties().put("jetty.webapps.uri", normalizeURI(webapp.getURI().toString()));
getProperties().put("jetty.webapps.uri", normalizeURI(webappPath.getParent().toUri().toString()));
}
}
catch(Exception e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.util.resource.Resource;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -981,4 +985,24 @@ public void testJettyStandardIdsAndProperties_JettyHomeUri_JettyBaseUri() throws
assertThat(propName, tc.getTestString(), startsWith("file:"));
}
}

@Test
public void testJettyStandardIdsAndProperties_JettyWebappsUri() throws Exception
{
Path war = MavenTestingUtils.getTargetPath("no.war");
XmlConfiguration configuration =
new XmlConfiguration("" +
"<Configure class=\"org.eclipse.jetty.xml.TestConfiguration\">" +
" <Set name=\"TestString\">" +
" <Property name=\"" + "jetty.webapps.uri" + "\"/>" +
" </Set>" +
"</Configure>");

configuration.setJettyStandardIdsAndProperties(null, Resource.newResource(war));

TestConfiguration tc = new TestConfiguration();
configuration.configure(tc);

assertThat("jetty.webapps.uri", tc.getTestString(), is(XmlConfiguration.normalizeURI(war.getParent().toUri().toString())));
}
}

0 comments on commit 0074c00

Please sign in to comment.