Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Bartel2013-06-11 04:39:15 -0400
committerJan Bartel2013-06-11 04:39:15 -0400
commitc5bdc019a2b7bfedd606b9531b4cd0aad66291e9 (patch)
tree38506352967fb72ba1c14d5081b9f40592218af3 /jetty-osgi/jetty-osgi-boot/src
parent2b1e6bf0de025c8f4223ee9e54d455db1da640db (diff)
downloadorg.eclipse.jetty.project-c5bdc019a2b7bfedd606b9531b4cd0aad66291e9.tar.gz
org.eclipse.jetty.project-c5bdc019a2b7bfedd606b9531b4cd0aad66291e9.tar.xz
org.eclipse.jetty.project-c5bdc019a2b7bfedd606b9531b4cd0aad66291e9.zip
409801 Jetty should allow webdefault to be specified using a relative location when running in OSGi
Diffstat (limited to 'jetty-osgi/jetty-osgi-boot/src')
-rw-r--r--jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractWebAppProvider.java26
1 files changed, 21 insertions, 5 deletions
diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractWebAppProvider.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractWebAppProvider.java
index 03d3dcc0e3..5e3d5b6658 100644
--- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractWebAppProvider.java
+++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractWebAppProvider.java
@@ -272,8 +272,13 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
if (tmp != null)
{
File defaultWebXml = getFile (tmp, bundleInstallLocation);
- if (defaultWebXml != null && defaultWebXml.exists())
- _webApp.setDefaultsDescriptor(defaultWebXml.getAbsolutePath());
+ if (defaultWebXml != null)
+ {
+ if (defaultWebXml.exists())
+ _webApp.setDefaultsDescriptor(defaultWebXml.getAbsolutePath());
+ else
+ LOG.warn(defaultWebXml.getAbsolutePath()+" does not exist");
+ }
}
//Handle Require-TldBundle
@@ -377,6 +382,7 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
HashMap properties = new HashMap();
properties.put("Server", getDeploymentManager().getServer());
properties.put(OSGiWebappConstants.JETTY_BUNDLE_ROOT, rootResource.toString());
+ properties.put(OSGiServerConstants.JETTY_HOME, getDeploymentManager().getServer().getAttribute(OSGiServerConstants.JETTY_HOME));
xmlConfiguration.getProperties().putAll(properties);
xmlConfiguration.configure(_webApp);
}
@@ -390,11 +396,21 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
{
if (file == null)
return null;
-
- if (file.startsWith("/") || file.startsWith("file:/"))
+
+ if (file.startsWith("/") || file.startsWith("file:/")) //absolute location
return new File(file);
else
- return new File(bundleInstall, file);
+ {
+ //relative location
+ //try inside the bundle first
+ File f = new File (bundleInstall, file);
+ if (f.exists()) return f;
+ String jettyHome = (String)getDeploymentManager().getServer().getAttribute(OSGiServerConstants.JETTY_HOME);
+ if (jettyHome != null)
+ return new File(jettyHome, file);
+ }
+
+ return null;
}
}

Back to the top