bug 343352

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@3024 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Hugues Malphettes 2011-04-20 08:22:39 +00:00
parent fe12431d2e
commit 511165b595
2 changed files with 27 additions and 1 deletions

View File

@ -1,6 +1,7 @@
jetty-7.4.1-SNAPSHOT jetty-7.4.1-SNAPSHOT
+ 343083 Set nested dispatch type. + 343083 Set nested dispatch type.
+ 343277 add support for a context white list + 343277 add support for a context white list
+ 343352 make sure that jetty.osgi.boot is activated when a WAB is registered
jetty-7.4.0.v20110414 jetty-7.4.0.v20110414
+ 342504 Scanner Listener + 342504 Scanner Listener

View File

@ -29,6 +29,8 @@ import org.eclipse.jetty.webapp.WebAppContext;
import org.osgi.framework.Bundle; import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceRegistration; import org.osgi.framework.ServiceRegistration;
import org.osgi.util.tracker.BundleTracker; import org.osgi.util.tracker.BundleTracker;
@ -207,7 +209,8 @@ public class JettyBootstrapActivator implements BundleActivator
*/ */
public static void registerWebapplication(Bundle contributor, String webappFolderPath, String contextPath) throws Exception public static void registerWebapplication(Bundle contributor, String webappFolderPath, String contextPath) throws Exception
{ {
WebAppContext contextHandler = new WebAppContext(); checkBundleActivated();
WebAppContext contextHandler = new WebAppContext();
Dictionary dic = new Hashtable(); Dictionary dic = new Hashtable();
dic.put(OSGiWebappConstants.SERVICE_PROP_WAR,webappFolderPath); dic.put(OSGiWebappConstants.SERVICE_PROP_WAR,webappFolderPath);
dic.put(OSGiWebappConstants.SERVICE_PROP_CONTEXT_PATH,contextPath); dic.put(OSGiWebappConstants.SERVICE_PROP_CONTEXT_PATH,contextPath);
@ -236,6 +239,7 @@ public class JettyBootstrapActivator implements BundleActivator
*/ */
public static void registerWebapplication(Bundle contributor, String webappFolderPath, String contextPath, Dictionary<String, String> dic) throws Exception public static void registerWebapplication(Bundle contributor, String webappFolderPath, String contextPath, Dictionary<String, String> dic) throws Exception
{ {
checkBundleActivated();
WebAppContext contextHandler = new WebAppContext(); WebAppContext contextHandler = new WebAppContext();
dic.put(OSGiWebappConstants.SERVICE_PROP_WAR,webappFolderPath); dic.put(OSGiWebappConstants.SERVICE_PROP_WAR,webappFolderPath);
dic.put(OSGiWebappConstants.SERVICE_PROP_CONTEXT_PATH,contextPath); dic.put(OSGiWebappConstants.SERVICE_PROP_CONTEXT_PATH,contextPath);
@ -275,6 +279,7 @@ public class JettyBootstrapActivator implements BundleActivator
*/ */
public static void registerContext(Bundle contributor, String contextFilePath, Dictionary<String, String> dic) throws Exception public static void registerContext(Bundle contributor, String contextFilePath, Dictionary<String, String> dic) throws Exception
{ {
checkBundleActivated();
ContextHandler contextHandler = new ContextHandler(); ContextHandler contextHandler = new ContextHandler();
dic.put(OSGiWebappConstants.SERVICE_PROP_CONTEXT_FILE_PATH,contextFilePath); dic.put(OSGiWebappConstants.SERVICE_PROP_CONTEXT_FILE_PATH,contextFilePath);
dic.put(IWebBundleDeployerHelper.INTERNAL_SERVICE_PROP_UNKNOWN_CONTEXT_HANDLER_TYPE,Boolean.TRUE.toString()); dic.put(IWebBundleDeployerHelper.INTERNAL_SERVICE_PROP_UNKNOWN_CONTEXT_HANDLER_TYPE,Boolean.TRUE.toString());
@ -286,5 +291,25 @@ public class JettyBootstrapActivator implements BundleActivator
// todo // todo
} }
/**
* Since org.eclipse.jetty.osgi.boot does not have a lazy activation policy
* when one fo the static methods to register a webapp is called we should make sure that
* the bundle is started.
*/
private static void checkBundleActivated()
{
if (INSTANCE == null) {
Bundle thisBundle = FrameworkUtil.getBundle(JettyBootstrapActivator.class);
try
{
thisBundle.start();
}
catch (BundleException e)
{
//nevermind.
}
}
}
} }