diff --git a/environments/servlet/core/src/main/java/org/jboss/weld/environment/jetty/JettyContainer.java b/environments/servlet/core/src/main/java/org/jboss/weld/environment/jetty/JettyContainer.java
index 73fbe4c344..42aae48d3e 100644
--- a/environments/servlet/core/src/main/java/org/jboss/weld/environment/jetty/JettyContainer.java
+++ b/environments/servlet/core/src/main/java/org/jboss/weld/environment/jetty/JettyContainer.java
@@ -27,22 +27,21 @@
/**
* Jetty Container.
*
- * This container requires that the jetty server register DecoratingListener
+ * This container requires that the jetty server register CdiDecoratingListener
* to dynamically register a decorator instance that wraps the {@link WeldDecorator}
* added as an attribute. The jetty decorate
module does this and indicates it's
- * availability by setting the "org.eclipse.jetty.webapp.DecoratingListener" to the
+ * availability by setting the "org.eclipse.jetty.ee10.webapp.DecoratingListener" to the
* name of the watched attribute.
*
*
*
* Jetty also provides the cdi-spi
module that may directly invoke the
* CDI SPI. This module indicates it's availability by setting the "org.eclipse.jetty.cdi"
- * context attribute to "CdiDecorator". If this module is used, then this JettyContainer
+ * context attribute to "CdiSpiDecorator". If this module is used, then this JettyContainer
* only logs a message and does no further integration.
*
*
- * @since Jetty 9.4.20
- * @see JettyLegacyContainer
+ * @since Jetty 12+
* @author Greg Wilkins
*/
public class JettyContainer extends AbstractJettyContainer {
@@ -51,8 +50,6 @@ public class JettyContainer extends AbstractJettyContainer {
public static final String CDI_SPI_DECORATOR_MODE = "CdiSpiDecorator";
public static final String CDI_DECORATING_LISTENER_MODE = "CdiDecoratingListener";
public static final String CDI_DECORATING_LISTENER_ATTRIBUTE = "org.eclipse.jetty.cdi.decorator";
- public static final String DECORATING_LISTENER_MODE = "DecoratingListener";
- public static final String DECORATING_LISTENER_ATTRIBUTE = "org.eclipse.jetty.webapp.DecoratingListener";
protected String classToCheck() {
// Never called because touch is overridden below.
@@ -62,11 +59,7 @@ protected String classToCheck() {
@Override
public boolean touch(ResourceLoader resourceLoader, ContainerContext context) throws Exception {
ServletContext servletContext = context.getServletContext();
- // The jetty cdi modules from 9.4.20 sets JETTY_CDI_ATTRIBUTE to indicate that a
- // DecoratingListener is registered. Weld-3.1.2.Final documented that the decorate module
- // could be used directly, which sets DECORATING_LISTENER_ATTRIBUTE
- return servletContext.getAttribute(JETTY_CDI_ATTRIBUTE) instanceof String ||
- servletContext.getAttribute(DECORATING_LISTENER_ATTRIBUTE) instanceof String;
+ return servletContext.getAttribute(JETTY_CDI_ATTRIBUTE) instanceof String;
}
@Override
@@ -74,13 +67,11 @@ public void initialize(ContainerContext context) {
try {
ServletContext servletContext = context.getServletContext();
String mode = (String) servletContext.getAttribute(JETTY_CDI_ATTRIBUTE);
- if (mode == null) {
- mode = DECORATING_LISTENER_MODE;
- }
switch (mode) {
case CDI_SPI_DECORATOR_MODE:
- // For use with the cdi-spi module
- // No further integration required
+ // For use with the cdi-spi module; no further integration required
+ // NOTE: this is an internal module/mode, and it's unexpected to be explicitly used
+ // We only keep track of it to be able to say it's not an error state
JettyLogger.LOG.jettyCdiSpiIsSupported();
break;
@@ -92,16 +83,6 @@ public void initialize(ContainerContext context) {
JettyLogger.LOG.jettyCdiDecorationIsSupported();
break;
- case DECORATING_LISTENER_MODE:
- // For use with the decorate module
- // This mode is only needed to match the Weld-3.1.2 documentation.
- // Initialize a JettyWeldInjector and create WeldDecorator for it
- super.initialize(context);
- String attribute = (String) servletContext.getAttribute(DECORATING_LISTENER_ATTRIBUTE);
- servletContext.setAttribute(attribute, new WeldDecorator(servletContext));
- JettyLogger.LOG.jettyDecorationIsSupported();
- break;
-
default:
throw JettyLogger.LOG.unknownIntegrationMode(mode);
}
diff --git a/environments/servlet/core/src/main/java/org/jboss/weld/environment/jetty/JettyLegacyContainer.java b/environments/servlet/core/src/main/java/org/jboss/weld/environment/jetty/JettyLegacyContainer.java
deleted file mode 100644
index ac6b7e6582..0000000000
--- a/environments/servlet/core/src/main/java/org/jboss/weld/environment/jetty/JettyLegacyContainer.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.weld.environment.jetty;
-
-import org.jboss.weld.environment.servlet.Container;
-import org.jboss.weld.environment.servlet.ContainerContext;
-import org.jboss.weld.environment.servlet.EnhancedListener;
-import org.jboss.weld.environment.servlet.logging.JettyLogger;
-
-/**
- * Legacy Jetty container.
- *
- * This container relies on the the following Jetty APIs to be exposed
- * to the webapp:
- *
- * - org.eclipse.jetty.server.handler.ContextHandler
- * - org.eclipse.jetty.servlet.ServletContextHandler
- * - org.eclipse.jetty.util.DecoratedObjectFactory
- * - org.eclipse.jetty.util.Decorator
- *
- * These APIs are exposed by the deprecated jetty cdi2
module.
- *
- *
- * @deprecated
- * @see JettyContainer
- * @author Ales Justin
- */
-@Deprecated
-public class JettyLegacyContainer extends AbstractJettyContainer {
-
- public static final Container INSTANCE = new JettyLegacyContainer();
-
- private static final String JETTY_REQUIRED_CLASS_NAME = "org.eclipse.jetty.util.Decorator";
-
- protected String classToCheck() {
- return JETTY_REQUIRED_CLASS_NAME;
- }
-
- @Override
- public void initialize(ContainerContext context) {
- // Try pushing a Jetty Injector into the servlet context
- try {
- super.initialize(context);
- LegacyWeldDecorator.process(context.getServletContext());
- if (Boolean.TRUE
- .equals(context.getServletContext().getAttribute(EnhancedListener.ENHANCED_LISTENER_USED_ATTRIBUTE_NAME))) {
- // ServletContainerInitializer works on versions prior to 9.1.1 but the listener injection doesn't
- JettyLogger.LOG.jettyDetectedListenersInjectionIsSupported();
- } else {
- JettyLogger.LOG.jettyDetectedListenersInjectionIsNotSupported();
- }
- } catch (Exception e) {
- JettyLogger.LOG.unableToCreateJettyWeldInjector(e);
- }
- }
-}
\ No newline at end of file
diff --git a/environments/servlet/core/src/main/java/org/jboss/weld/environment/jetty/LegacyWeldDecorator.java b/environments/servlet/core/src/main/java/org/jboss/weld/environment/jetty/LegacyWeldDecorator.java
deleted file mode 100644
index 1c2124d8e0..0000000000
--- a/environments/servlet/core/src/main/java/org/jboss/weld/environment/jetty/LegacyWeldDecorator.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.weld.environment.jetty;
-
-import jakarta.servlet.ServletContext;
-
-import org.eclipse.jetty.server.handler.ContextHandler;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.util.DecoratedObjectFactory;
-import org.eclipse.jetty.util.Decorator;
-
-/**
- * Jetty Eclipse Weld support for jetty >=9 and <= 9.4.20
- *
- *
- * This decorator relies on the the following Jetty APIs to be exposed
- * to the webapp:
- *
- * - org.eclipse.jetty.server.handler.ContextHandler
- * - org.eclipse.jetty.servlet.ServletContextHandler
- * - org.eclipse.jetty.util.DecoratedObjectFactory
- * - org.eclipse.jetty.util.Decorator
- *
- *
- * @author Ales Justin
- */
-public class LegacyWeldDecorator extends WeldDecorator implements Decorator {
-
- protected LegacyWeldDecorator(ServletContext servletContext) {
- super(servletContext);
- }
-
- public static void process(ServletContext context) {
- if (context instanceof ContextHandler.Context) {
- ContextHandler.Context cc = (ContextHandler.Context) context;
- ContextHandler handler = cc.getContextHandler();
- if (handler instanceof ServletContextHandler) {
- ServletContextHandler sch = (ServletContextHandler) handler;
- DecoratedObjectFactory decObjFact = sch.getObjectFactory();
- decObjFact.addDecorator(new LegacyWeldDecorator(context));
- }
- }
- }
-}
diff --git a/environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/WeldServletLifecycle.java b/environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/WeldServletLifecycle.java
index 442b7125cd..e4a87cf571 100644
--- a/environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/WeldServletLifecycle.java
+++ b/environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/WeldServletLifecycle.java
@@ -54,7 +54,6 @@
import org.jboss.weld.environment.deployment.discovery.DiscoveryStrategyFactory;
import org.jboss.weld.environment.deployment.discovery.jandex.Jandex;
import org.jboss.weld.environment.jetty.JettyContainer;
-import org.jboss.weld.environment.jetty.JettyLegacyContainer;
import org.jboss.weld.environment.logging.CommonLogger;
import org.jboss.weld.environment.servlet.deployment.ServletContextBeanArchiveHandler;
import org.jboss.weld.environment.servlet.deployment.WebAppBeanArchiveScanner;
@@ -371,8 +370,7 @@ protected Container findContainer(ContainerContext ctx, StringBuilder dump) {
if (container == null) {
// 3. Built-in containers in predefined order
container = checkContainers(ctx, dump,
- Arrays.asList(TomcatContainer.INSTANCE, JettyContainer.INSTANCE, JettyLegacyContainer.INSTANCE,
- UndertowContainer.INSTANCE));
+ Arrays.asList(TomcatContainer.INSTANCE, JettyContainer.INSTANCE, UndertowContainer.INSTANCE));
}
}
return container;