Issue #5264 - Updating embedded JettyDistro to JettyHome
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
parent
faf6d80390
commit
934a95b8ef
|
@ -31,22 +31,22 @@ import org.slf4j.LoggerFactory;
|
|||
* <ul>
|
||||
* <li>The <code>jetty.home</code> system property</li>
|
||||
* <li>The <code>JETTY_HOME</code> environment variable</li>
|
||||
* <li>The working directory hierarchy with subdirectory <code>jetty-distribution/target/distribution</code></li>
|
||||
* <li>The working directory hierarchy with subdirectory <code>jetty-home/target/jetty-home</code></li>
|
||||
* </ul>
|
||||
*/
|
||||
public class JettyDistribution
|
||||
public class JettyHome
|
||||
{
|
||||
private static final Logger LOG = LoggerFactory.getLogger(JettyDistribution.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(JettyHome.class);
|
||||
public static final Path DISTRIBUTION;
|
||||
|
||||
static
|
||||
{
|
||||
Path jettyHome = asDirectory(System.getProperty("jetty.home"));
|
||||
LOG.debug("JettyDistribution(prop(jetty.home)) = {}", jettyHome);
|
||||
LOG.debug("JettyHome(prop(jetty.home)) = {}", jettyHome);
|
||||
if (jettyHome == null)
|
||||
{
|
||||
jettyHome = asDirectory(System.getenv().get("JETTY_HOME"));
|
||||
LOG.debug("JettyDistribution(env(JETTY_HOME)) = {}", jettyHome);
|
||||
LOG.debug("JettyHome(env(JETTY_HOME)) = {}", jettyHome);
|
||||
}
|
||||
|
||||
Path distro = null;
|
||||
|
@ -66,10 +66,10 @@ public class JettyDistribution
|
|||
{
|
||||
Path working = Paths.get(System.getProperty("user.dir"));
|
||||
Path dir = null;
|
||||
LOG.debug("JettyDistribution(prop(user.dir)) = {}", working);
|
||||
LOG.debug("JettyHome(prop(user.dir)) = {}", working);
|
||||
while (dir == null && working != null)
|
||||
{
|
||||
dir = asDirectory(working.resolve("jetty-distribution/target/distribution").toString());
|
||||
dir = asDirectory(working.resolve("jetty-home/target/jetty-home").toString());
|
||||
if (dir != null && hasDemoBase(dir))
|
||||
{
|
||||
distro = dir;
|
||||
|
@ -78,7 +78,7 @@ public class JettyDistribution
|
|||
working = working.getParent();
|
||||
}
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("JettyDistribution(working.resolve(...)) = {}", distro);
|
||||
LOG.debug("JettyHome(working.resolve(...)) = {}", distro);
|
||||
}
|
||||
catch (Throwable th)
|
||||
{
|
||||
|
@ -88,12 +88,12 @@ public class JettyDistribution
|
|||
|
||||
if (distro == null)
|
||||
{
|
||||
LOG.info("JettyDistribution() FAILURE: NOT FOUND");
|
||||
LOG.info("JettyHome() FAILURE: NOT FOUND");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("JettyDistribution() FOUND = {}", distro);
|
||||
LOG.debug("JettyHome() FOUND = {}", distro);
|
||||
}
|
||||
DISTRIBUTION = distro;
|
||||
}
|
|
@ -66,7 +66,7 @@ public class LikeJettyXml
|
|||
public static Server createServer(int port, int securePort, boolean addDebugListener) throws Exception
|
||||
{
|
||||
// Path to as-built jetty-distribution directory
|
||||
Path jettyDistro = JettyDistribution.get();
|
||||
Path jettyDistro = JettyHome.get();
|
||||
|
||||
// Find jetty home and base directories
|
||||
String homePath = System.getProperty("jetty.home", jettyDistro.resolve("jetty-home").toString());
|
||||
|
|
|
@ -43,7 +43,7 @@ public class OneWebApp
|
|||
// PlusConfiguration) to choosing where the webapp will unpack itself.
|
||||
WebAppContext webapp = new WebAppContext();
|
||||
webapp.setContextPath("/");
|
||||
File warFile = JettyDistribution.resolve("demo-base/webapps/async-rest.war").toFile();
|
||||
File warFile = JettyHome.resolve("demo-base/webapps/async-rest.war").toFile();
|
||||
webapp.setWar(warFile.getAbsolutePath());
|
||||
|
||||
// A WebAppContext is a ContextHandler as well so it needs to be set to
|
||||
|
|
|
@ -51,7 +51,7 @@ public class OneWebAppWithJsp
|
|||
// the webapp will unpack itself.
|
||||
WebAppContext webapp = new WebAppContext();
|
||||
webapp.setContextPath("/");
|
||||
Path warFile = JettyDistribution.resolve("demo-base/webapps/test.war");
|
||||
Path warFile = JettyHome.resolve("demo-base/webapps/test.war");
|
||||
if (!Files.exists(warFile))
|
||||
{
|
||||
throw new FileNotFoundException(warFile.toString());
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ServerWithAnnotations
|
|||
webapp.addConfiguration(new EnvConfiguration(), new PlusConfiguration(), new AnnotationConfiguration());
|
||||
|
||||
webapp.setContextPath("/");
|
||||
File warFile = JettyDistribution.resolve("demo-base/webapps/test-spec.war").toFile();
|
||||
File warFile = JettyHome.resolve("demo-base/webapps/test-spec.war").toFile();
|
||||
webapp.setWar(warFile.getAbsolutePath());
|
||||
webapp.setAttribute(
|
||||
"org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
|
||||
|
|
|
@ -41,7 +41,7 @@ public class ServerWithJNDI
|
|||
// Create a WebApp
|
||||
WebAppContext webapp = new WebAppContext();
|
||||
webapp.setContextPath("/");
|
||||
Path testJndiWar = JettyDistribution.resolve("demo-base/webapps/test-jndi.war");
|
||||
Path testJndiWar = JettyHome.resolve("demo-base/webapps/test-jndi.war");
|
||||
webapp.setWarResource(new PathResource(testJndiWar));
|
||||
server.setHandler(webapp);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class LikeJettyXmlTest extends AbstractEmbeddedTest
|
|||
@BeforeEach
|
||||
public void startServer() throws Exception
|
||||
{
|
||||
assumeTrue(JettyDistribution.DISTRIBUTION != null, "jetty-distribution not found");
|
||||
assumeTrue(JettyHome.DISTRIBUTION != null, "jetty-distribution not found");
|
||||
|
||||
server = LikeJettyXml.createServer(0, 0, false);
|
||||
server.start();
|
||||
|
|
|
@ -42,7 +42,7 @@ public class OneWebAppTest extends AbstractEmbeddedTest
|
|||
@BeforeEach
|
||||
public void startServer() throws Exception
|
||||
{
|
||||
assumeTrue(JettyDistribution.DISTRIBUTION != null, "jetty-distribution not found");
|
||||
assumeTrue(JettyHome.DISTRIBUTION != null, "jetty-distribution not found");
|
||||
|
||||
server = OneWebApp.createServer(0);
|
||||
server.start();
|
||||
|
|
|
@ -42,7 +42,7 @@ public class OneWebAppWithJspTest extends AbstractEmbeddedTest
|
|||
@BeforeEach
|
||||
public void startServer() throws Exception
|
||||
{
|
||||
assumeTrue(JettyDistribution.DISTRIBUTION != null, "jetty-distribution not found");
|
||||
assumeTrue(JettyHome.DISTRIBUTION != null, "jetty-distribution not found");
|
||||
|
||||
server = OneWebAppWithJsp.createServer(0);
|
||||
server.start();
|
||||
|
|
|
@ -41,7 +41,7 @@ public class ServerWithAnnotationsTest extends AbstractEmbeddedTest
|
|||
@BeforeEach
|
||||
public void startServer() throws Exception
|
||||
{
|
||||
assumeTrue(JettyDistribution.DISTRIBUTION != null, "jetty-distribution not found");
|
||||
assumeTrue(JettyHome.DISTRIBUTION != null, "jetty-distribution not found");
|
||||
|
||||
server = ServerWithAnnotations.createServer(0);
|
||||
server.start();
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ServerWithJNDITest extends AbstractEmbeddedTest
|
|||
@BeforeEach
|
||||
public void startServer() throws Exception
|
||||
{
|
||||
assumeTrue(JettyDistribution.DISTRIBUTION != null, "jetty-distribution not found");
|
||||
assumeTrue(JettyHome.DISTRIBUTION != null, "jetty-distribution not found");
|
||||
|
||||
server = ServerWithJNDI.createServer(0);
|
||||
server.start();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Jetty Logging using jetty-slf4j-impl
|
||||
org.eclipse.jetty.LEVEL=INFO
|
||||
org.eclipse.jetty.embedded.JettyDistribution.LEVEL=DEBUG
|
||||
org.eclipse.jetty.embedded.JettyHome.LEVEL=DEBUG
|
||||
#org.eclipse.jetty.STACKS=true
|
||||
#org.eclipse.jetty.STACKS=false
|
||||
#org.eclipse.jetty.io.LEVEL=DEBUG
|
||||
|
|
Loading…
Reference in New Issue