This commit is contained in:
Jan Bartel 2017-09-19 14:32:34 +10:00
parent eee41174f2
commit d808094e82
2 changed files with 20 additions and 1 deletions

View File

@ -25,9 +25,11 @@ import java.util.Set;
import javax.servlet.ServletContainerInitializer;
import org.eclipse.jetty.annotations.AnnotationParser.Handler;
import org.eclipse.jetty.osgi.boot.OSGiWebInfConfiguration;
import org.eclipse.jetty.osgi.boot.OSGiWebappConstants;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
@ -184,6 +186,23 @@ public class AnnotationConfiguration extends org.eclipse.jetty.annotations.Annot
parseBundle(context,parser,webbundle,webbundle);
}
/**
* @see org.eclipse.jetty.annotations.AnnotationConfiguration#parseWebInfClasses(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.annotations.AnnotationParser)
*/
@Override
public void parseWebInfClasses(WebAppContext context, org.eclipse.jetty.annotations.AnnotationParser parser)
throws Exception
{
Bundle webbundle = (Bundle) context.getAttribute(OSGiWebappConstants.JETTY_OSGI_BUNDLE);
String bundleClasspath = (String)webbundle.getHeaders().get(Constants.BUNDLE_CLASSPATH);
//only scan WEB-INF/classes if we didn't already scan it with parseWebBundle
if (StringUtil.isBlank(bundleClasspath) || !bundleClasspath.contains("WEB-INF/classes"))
super.parseWebInfClasses(context, parser);
}
/**
* Scan a bundle required by the webbundle for servlet annotations
* @param context The webapp context

View File

@ -128,7 +128,7 @@ public class TestOSGiUtil
for (Bundle b : bundleContext.getBundles())
{
bundlesIndexedBySymbolicName.put(b.getSymbolicName(), b);
System.err.println(" " + b.getSymbolicName() + " " + b.getLocation() + " " + b.getVersion()+ " " + b.getState());
System.err.println(" " + b.getBundleId()+" "+b.getSymbolicName() + " " + b.getLocation() + " " + b.getVersion()+ " " + b.getState());
}
}