Added extra debug to jetty osgi; added proper manifest to test-webapp-fragment

This commit is contained in:
Jan Bartel 2014-11-07 11:41:48 +11:00
parent 0b68144a27
commit 244f97a9d1
3 changed files with 57 additions and 7 deletions

View File

@ -252,6 +252,12 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
(overrideBundleInstallLocation == null
? BundleFileLocatorHelperFactory.getFactory().getHelper().getBundleInstallLocation(_bundle)
: new File(overrideBundleInstallLocation));
if (LOG.isDebugEnabled())
{
LOG.debug("Bundle location is {}, install location: {}", _bundle.getLocation(), bundleInstallLocation);
}
URL url = null;
Resource rootResource = Resource.newResource(BundleFileLocatorHelperFactory.getFactory().getHelper().getLocalURL(bundleInstallLocation.toURI().toURL()));
//try and make sure the rootResource is useable - if its a jar then make it a jar file url
@ -266,6 +272,8 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
if (_webAppPath == null || _webAppPath.length() == 0 || ".".equals(_webAppPath))
{
url = bundleInstallLocation.toURI().toURL();
if (LOG.isDebugEnabled())
LOG.debug("Webapp base using bundle install location: {}", url);
}
else
{
@ -273,16 +281,24 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
if (_webAppPath.startsWith("/") || _webAppPath.startsWith("file:"))
{
url = new File(_webAppPath).toURI().toURL();
if (LOG.isDebugEnabled())
LOG.debug("Webapp base using absolute location: {}", url);
}
else if (bundleInstallLocation != null && bundleInstallLocation.isDirectory())
{
url = new File(bundleInstallLocation, _webAppPath).toURI().toURL();
if (LOG.isDebugEnabled())
LOG.debug("Webapp base using path relative to bundle unpacked install location: {}", url);
}
else if (bundleInstallLocation != null)
{
Enumeration<URL> urls = BundleFileLocatorHelperFactory.getFactory().getHelper().findEntries(_bundle, _webAppPath);
if (urls != null && urls.hasMoreElements())
{
url = urls.nextElement();
if (LOG.isDebugEnabled())
LOG.debug("Webapp base using path relative to packed bundle location: {}", url);
}
}
}

View File

@ -105,6 +105,7 @@ public class OSGiWebInfConfiguration extends WebInfConfiguration
for (Bundle bundle : bundles)
{
LOG.debug("Checking bundle {}:{}", bundle.getBundleId(), bundle.getSymbolicName());
if (pattern != null)
{
// if bundle symbolic name matches the pattern

View File

@ -17,6 +17,46 @@
<verbose>false</verbose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>artifact-jar</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifestFile>target/classes/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<instructions>
<Bundle-SymbolicName>org.eclipse.jetty.tests.test-web-fragment;singleton:=true</Bundle-SymbolicName>
<Bundle-Description>A bundle containing web fragment for testing</Bundle-Description>
<Export-Package>com.acme.fragment;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}"</Export-Package>
<_nouses>true</_nouses>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
@ -24,12 +64,5 @@
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<!--
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
</dependency>
-->
</dependencies>
</project>