Skip to content

Commit

Permalink
WELD-2787 Remove legacy integration points for Jetty
Browse files Browse the repository at this point in the history
  • Loading branch information
manovotn committed Apr 25, 2024
1 parent 65f1d11 commit 140522f
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 154 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
* </p>
*
* @since Jetty 9.4.20
* @see JettyLegacyContainer
* @author <a href="mailto:[email protected]">Greg Wilkins</a>
*/
public class JettyContainer extends AbstractJettyContainer {
Expand All @@ -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.
Expand All @@ -62,21 +59,14 @@ 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
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
Expand All @@ -92,16 +82,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);
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 140522f

Please sign in to comment.