Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Bartel2015-05-01 02:00:24 -0400
committerJan Bartel2015-05-01 02:01:27 -0400
commitbe3b9497a6fa88db39cd96a196576b81b6f044d7 (patch)
tree17a71696b096d25afff9fa340ec39e3e8173c5b6 /jetty-osgi/jetty-osgi-boot/src
parent22714644063eab5aa07d7baa135899af7176da15 (diff)
downloadorg.eclipse.jetty.project-be3b9497a6fa88db39cd96a196576b81b6f044d7.tar.gz
org.eclipse.jetty.project-be3b9497a6fa88db39cd96a196576b81b6f044d7.tar.xz
org.eclipse.jetty.project-be3b9497a6fa88db39cd96a196576b81b6f044d7.zip
464630 Cannot configure Configuration classlist 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.java79
1 files changed, 36 insertions, 43 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 69010e11f8..9bb74c50f2 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
@@ -23,7 +23,6 @@ import java.net.URL;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.HashMap;
-import java.util.List;
import org.eclipse.jetty.deploy.App;
import org.eclipse.jetty.deploy.AppProvider;
@@ -32,13 +31,13 @@ import org.eclipse.jetty.osgi.boot.internal.serverfactory.ServerInstanceWrapper;
import org.eclipse.jetty.osgi.boot.internal.webapp.OSGiWebappClassLoader;
import org.eclipse.jetty.osgi.boot.utils.BundleFileLocatorHelperFactory;
import org.eclipse.jetty.server.handler.ContextHandler;
-import org.eclipse.jetty.util.ArrayUtil;
import org.eclipse.jetty.util.Loader;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.JarResource;
import org.eclipse.jetty.util.resource.Resource;
+import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.xml.XmlConfiguration;
import org.osgi.framework.Bundle;
@@ -56,40 +55,12 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
{
private static final Logger LOG = Log.getLogger(AbstractWebAppProvider.class);
- public static String __defaultConfigurations[] = {
- "org.eclipse.jetty.osgi.boot.OSGiWebInfConfiguration",
- "org.eclipse.jetty.webapp.WebXmlConfiguration",
- "org.eclipse.jetty.webapp.MetaInfConfiguration",
- "org.eclipse.jetty.webapp.FragmentConfiguration",
- "org.eclipse.jetty.webapp.JettyWebXmlConfiguration"
- };
-
- public static void setDefaultConfigurations (String[] defaultConfigs)
- {
- __defaultConfigurations = defaultConfigs;
- }
-
- public static String[] getDefaultConfigurations ()
- {
- List<String> configs = ArrayUtil.asMutableList(__defaultConfigurations);
- if (annotationsAvailable())
- {
- //add before JettyWebXmlConfiguration
- int i = configs.indexOf("org.eclipse.jetty.webapp.JettyWebXmlConfiguration");
- configs.add(i, "org.eclipse.jetty.osgi.annotations.AnnotationConfiguration");
- }
-
- if (jndiAvailable())
- {
- //add in EnvConfiguration and PlusConfiguration just after FragmentConfiguration
- int i = configs.indexOf("org.eclipse.jetty.webapp.FragmentConfiguration");
- configs.add(++i, "org.eclipse.jetty.plus.webapp.EnvConfiguration");
- configs.add(++i, "org.eclipse.jetty.plus.webapp.PlusConfiguration");
- }
-
- return configs.toArray(new String[configs.size()]);
- }
-
+ /* ------------------------------------------------------------ */
+ /**
+ * Check if we should be enabling annotation processing
+ *
+ * @return true if the jetty-annotations.jar is present, false otherwise
+ */
private static boolean annotationsAvailable()
{
boolean result = false;
@@ -108,7 +79,12 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
return result;
}
-
+ /* ------------------------------------------------------------ */
+ /**
+ * Check if jndi is support is present.
+ *
+ * @return true if the jetty-jndi.jar is present, false otherwise
+ */
private static boolean jndiAvailable()
{
try
@@ -140,11 +116,13 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
private ServerInstanceWrapper _serverWrapper;
+
+
/* ------------------------------------------------------------ */
/**
* OSGiApp
*
- *
+ * Represents a deployable webapp.
*/
public class OSGiApp extends AbstractOSGiApp
{
@@ -310,10 +288,8 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
// Set up what has been configured on the provider
_webApp.setParentLoaderPriority(isParentLoaderPriority());
_webApp.setExtractWAR(isExtract());
- if (getConfigurationClasses() != null)
- _webApp.setConfigurationClasses(getConfigurationClasses());
- else
- _webApp.setConfigurationClasses(getDefaultConfigurations());
+ _webApp.setConfigurationClasses(getConfigurationClasses());
+
if (getDefaultsDescriptor() != null)
_webApp.setDefaultsDescriptor(getDefaultsDescriptor());
@@ -601,8 +577,25 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
/* ------------------------------------------------------------ */
public String[] getConfigurationClasses()
{
- return _configurationClasses;
+ if (_configurationClasses != null)
+ return _configurationClasses;
+
+ Configuration.ClassList defaults = Configuration.ClassList.serverDefault(_serverWrapper.getServer());
+
+ //add before JettyWebXmlConfiguration
+ if (annotationsAvailable())
+ defaults.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
+ "org.eclipse.jetty.osgi.annotations.AnnotationConfiguration");
+
+ //add in EnvConfiguration and PlusConfiguration just after FragmentConfiguration
+ if (jndiAvailable())
+ defaults.addAfter("org.eclipse.jetty.webapp.FragmentConfiguration",
+ "org.eclipse.jetty.plus.webapp.EnvConfiguration",
+ "org.eclipse.jetty.plus.webapp.PlusConfiguration");
+ String[] asArray = new String[defaults.size()];
+ return defaults.toArray(asArray);
}
+
/* ------------------------------------------------------------ */
public void setServerInstanceWrapper(ServerInstanceWrapper wrapper)

Back to the top