Revert changes to ServletContainerInitializer
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
7760d04a87
commit
ed86361581
|
@ -747,33 +747,6 @@ public class ServletContextHandler extends ContextHandler
|
||||||
relinkHandlers();
|
relinkHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Utility Method to allow for manual execution of {@link javax.servlet.ServletContainerInitializer} when using Embedded Jetty.
|
|
||||||
* @param containerInitializer the ServletContainerInitializer to register.
|
|
||||||
* @see Initializer
|
|
||||||
*/
|
|
||||||
public void addServletContainerInitializer(ServletContainerInitializer containerInitializer)
|
|
||||||
{
|
|
||||||
if (!isStopped())
|
|
||||||
throw new IllegalStateException("ServletContainerInitializers should be added before starting");
|
|
||||||
|
|
||||||
addServletContainerInitializer(containerInitializer, Collections.emptySet());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Utility Method to allow for manual execution of {@link javax.servlet.ServletContainerInitializer} when using Embedded Jetty.
|
|
||||||
* @param containerInitializer the ServletContainerInitializer to register.
|
|
||||||
* @param classes the Set of application classes.
|
|
||||||
* @see Initializer
|
|
||||||
*/
|
|
||||||
public void addServletContainerInitializer(ServletContainerInitializer containerInitializer, Set<Class<?>> classes)
|
|
||||||
{
|
|
||||||
if (!isStopped())
|
|
||||||
throw new IllegalStateException("ServletContainerInitializers should be added before starting");
|
|
||||||
|
|
||||||
addManaged(new Initializer(this, containerInitializer, classes));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The DecoratedObjectFactory for use by IoC containers (weld / spring / etc)
|
* The DecoratedObjectFactory for use by IoC containers (weld / spring / etc)
|
||||||
*
|
*
|
||||||
|
|
|
@ -25,9 +25,7 @@ import javax.servlet.ServletContextListener;
|
||||||
/**
|
/**
|
||||||
* Utility Methods for manual execution of {@link javax.servlet.ServletContainerInitializer} when
|
* Utility Methods for manual execution of {@link javax.servlet.ServletContainerInitializer} when
|
||||||
* using Embedded Jetty.
|
* using Embedded Jetty.
|
||||||
* @deprecated use {@link org.eclipse.jetty.servlet.ServletContextHandler#addServletContainerInitializer(ServletContainerInitializer)}.
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public final class ContainerInitializer
|
public final class ContainerInitializer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
|
// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others.
|
||||||
//
|
//
|
||||||
// This program and the accompanying materials are made available under the
|
// This program and the accompanying materials are made available under the
|
||||||
// terms of the Eclipse Public License v. 2.0 which is available at
|
// terms of the Eclipse Public License v. 2.0 which is available at
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
|
// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others.
|
||||||
//
|
//
|
||||||
// This program and the accompanying materials are made available under the
|
// This program and the accompanying materials are made available under the
|
||||||
// terms of the Eclipse Public License v. 2.0 which is available at
|
// terms of the Eclipse Public License v. 2.0 which is available at
|
||||||
|
|
|
@ -103,29 +103,29 @@ public class EmbeddedWeldTest
|
||||||
|
|
||||||
case "CdiServletContainerInitializer+Listener":
|
case "CdiServletContainerInitializer+Listener":
|
||||||
// Expect:INFO: WELD-ENV-001213: Jetty CDI SPI support detected, CDI injection will be available in Listeners, Servlets and Filters.
|
// Expect:INFO: WELD-ENV-001213: Jetty CDI SPI support detected, CDI injection will be available in Listeners, Servlets and Filters.
|
||||||
context.addServletContainerInitializer(new CdiServletContainerInitializer());
|
context.addBean(new ServletContextHandler.Initializer(context, new CdiServletContainerInitializer()));
|
||||||
context.addEventListener(new org.jboss.weld.environment.servlet.Listener());
|
context.addEventListener(new org.jboss.weld.environment.servlet.Listener());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "CdiServletContainerInitializer(CdiDecoratingListener)+Listener":
|
case "CdiServletContainerInitializer(CdiDecoratingListener)+Listener":
|
||||||
// Expect:INFO: WELD-ENV-001212: Jetty CdiDecoratingListener support detected, CDI injection will be available in Listeners, Servlets and Filters
|
// Expect:INFO: WELD-ENV-001212: Jetty CdiDecoratingListener support detected, CDI injection will be available in Listeners, Servlets and Filters
|
||||||
context.setInitParameter(CdiServletContainerInitializer.CDI_INTEGRATION_ATTRIBUTE, CdiDecoratingListener.MODE);
|
context.setInitParameter(CdiServletContainerInitializer.CDI_INTEGRATION_ATTRIBUTE, CdiDecoratingListener.MODE);
|
||||||
context.addServletContainerInitializer(new CdiServletContainerInitializer());
|
context.addBean(new ServletContextHandler.Initializer(context, new CdiServletContainerInitializer()));
|
||||||
context.addEventListener(new org.jboss.weld.environment.servlet.Listener());
|
context.addEventListener(new org.jboss.weld.environment.servlet.Listener());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "CdiServletContainerInitializer+EnhancedListener":
|
case "CdiServletContainerInitializer+EnhancedListener":
|
||||||
// Expect:INFO: WELD-ENV-001213: Jetty CDI SPI support detected, CDI injection will be available in Listeners, Servlets and Filters.
|
// Expect:INFO: WELD-ENV-001213: Jetty CDI SPI support detected, CDI injection will be available in Listeners, Servlets and Filters.
|
||||||
context.addServletContainerInitializer(new CdiServletContainerInitializer());
|
context.addBean(new ServletContextHandler.Initializer(context, new CdiServletContainerInitializer()));
|
||||||
context.addServletContainerInitializer(new org.jboss.weld.environment.servlet.EnhancedListener());
|
context.addBean(new ServletContextHandler.Initializer(context, new org.jboss.weld.environment.servlet.EnhancedListener()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// NOTE: This is the preferred mode from the Weld team.
|
// NOTE: This is the preferred mode from the Weld team.
|
||||||
case "CdiServletContainerInitializer(CdiDecoratingListener)+EnhancedListener":
|
case "CdiServletContainerInitializer(CdiDecoratingListener)+EnhancedListener":
|
||||||
// Expect:INFO: WELD-ENV-001212: Jetty CdiDecoratingListener support detected, CDI injection will be available in Listeners, Servlets and Filters
|
// Expect:INFO: WELD-ENV-001212: Jetty CdiDecoratingListener support detected, CDI injection will be available in Listeners, Servlets and Filters
|
||||||
context.setInitParameter(CdiServletContainerInitializer.CDI_INTEGRATION_ATTRIBUTE, CdiDecoratingListener.MODE);
|
context.setInitParameter(CdiServletContainerInitializer.CDI_INTEGRATION_ATTRIBUTE, CdiDecoratingListener.MODE);
|
||||||
context.addServletContainerInitializer(new CdiServletContainerInitializer());
|
context.addBean(new ServletContextHandler.Initializer(context, new CdiServletContainerInitializer()));
|
||||||
context.addServletContainerInitializer(new org.jboss.weld.environment.servlet.EnhancedListener());
|
context.addBean(new ServletContextHandler.Initializer(context, new org.jboss.weld.environment.servlet.EnhancedListener()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,8 +190,8 @@ public class EmbeddedWeldTest
|
||||||
server.setHandler(webapp);
|
server.setHandler(webapp);
|
||||||
|
|
||||||
webapp.setInitParameter(CdiServletContainerInitializer.CDI_INTEGRATION_ATTRIBUTE, CdiDecoratingListener.MODE);
|
webapp.setInitParameter(CdiServletContainerInitializer.CDI_INTEGRATION_ATTRIBUTE, CdiDecoratingListener.MODE);
|
||||||
webapp.addServletContainerInitializer(new CdiServletContainerInitializer());
|
webapp.addBean(new ServletContextHandler.Initializer(webapp, new CdiServletContainerInitializer()));
|
||||||
webapp.addServletContainerInitializer(new org.jboss.weld.environment.servlet.EnhancedListener());
|
webapp.addBean(new ServletContextHandler.Initializer(webapp, new org.jboss.weld.environment.servlet.EnhancedListener()));
|
||||||
|
|
||||||
String pkg = EmbeddedWeldTest.class.getPackage().getName();
|
String pkg = EmbeddedWeldTest.class.getPackage().getName();
|
||||||
webapp.getServerClassMatcher().add("-" + pkg + ".");
|
webapp.getServerClassMatcher().add("-" + pkg + ".");
|
||||||
|
|
Loading…
Reference in New Issue