or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

classloader.mdconfiguration.mdindex.mdmetadata.mdwebapp-context.md
tile.json

tessl/maven-org-eclipse-jetty-ee10--jetty-ee10-webapp

Jetty web application support for Jakarta EE 10 with full servlet specification compliance

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.eclipse.jetty.ee10/jetty-ee10-webapp@12.0.x

To install, run

npx @tessl/cli install tessl/maven-org-eclipse-jetty-ee10--jetty-ee10-webapp@12.0.0

index.mddocs/

Jetty EE10 WebApp

Jetty EE10 WebApp provides comprehensive web application support for Jakarta EE 10 within the Eclipse Jetty web server framework. It enables deployment, configuration, and management of Java web applications with full Jakarta EE 10 compliance, offering features like web.xml parsing, annotation scanning, fragment processing, security configuration, JNDI integration, and class loading isolation.

Package Information

  • Package Name: org.eclipse.jetty.ee10:jetty-ee10-webapp
  • Package Type: Maven
  • Language: Java
  • Version: 12.0.21
  • License: EPL-2.0 OR Apache-2.0
  • Installation: Add Maven dependency:
<dependency>
    <groupId>org.eclipse.jetty.ee10</groupId>
    <artifactId>jetty-ee10-webapp</artifactId>
    <version>12.0.21</version>
</dependency>

Core Imports

import org.eclipse.jetty.ee10.webapp.WebAppContext;
import org.eclipse.jetty.ee10.webapp.WebAppClassLoader;
import org.eclipse.jetty.ee10.webapp.Configuration;
import org.eclipse.jetty.ee10.webapp.Configurations;

Basic Usage

import org.eclipse.jetty.ee10.webapp.WebAppContext;
import org.eclipse.jetty.server.Server;

// Create a basic web application context
WebAppContext webapp = new WebAppContext();
webapp.setWar("/path/to/webapp.war");
webapp.setContextPath("/myapp");

// Add to server
Server server = new Server(8080);
server.setHandler(webapp);
server.start();

Architecture

The Jetty EE10 WebApp module is built around several key architectural components:

  • WebAppContext: Main entry point that orchestrates web application deployment
  • Configuration System: Pluggable configurations handle specific aspects of the servlet specification
  • ClassLoader System: Provides isolation and customizable class visibility
  • Metadata Processing: Handles web.xml, annotations, and fragment processing
  • Service Provider Pattern: Enables modular configuration discovery

Capabilities

Web Application Context Management

Core functionality for creating, configuring, and managing web application contexts.

public class WebAppContext extends ServletContextHandler 
    implements WebAppClassLoader.Context, Deployable {
    
    public WebAppContext();
    public WebAppContext(String webApp, String contextPath);
    public WebAppContext(Resource webApp, String contextPath);
    public WebAppContext(SessionHandler sessionHandler, 
        SecurityHandler securityHandler, ServletHandler servletHandler, 
        ErrorHandler errorHandler);
    public WebAppContext(String contextPath, SessionHandler sessionHandler, 
        SecurityHandler securityHandler, ServletHandler servletHandler, 
        ErrorHandler errorHandler, int options);
    public static WebAppContext getCurrentWebAppContext();
    public void setWar(String war);
    public boolean configure() throws Exception;
    public void preConfigure() throws Exception;
    public void postConfigure() throws Exception;
}

Web Application Context

ClassLoader Management

Specialized classloading with visibility controls and performance optimizations.

public class WebAppClassLoader extends URLClassLoader 
    implements ClassVisibilityChecker {
    
    public WebAppClassLoader(Context context);
    public WebAppClassLoader(ClassLoader parent, Context context);
    public void addClassPath(Resource resource);
    public void addClassPath(String classPathList) throws IOException;
    public void addJars(Resource libs);
    public boolean isProtectedClass(Class<?> clazz);
    public boolean isHiddenClass(Class<?> clazz);
    public static <T> T runWithServerClassAccess(
        PrivilegedExceptionAction<T> action) throws Exception;
}

public class CachingWebAppClassLoader extends WebAppClassLoader {
    public CachingWebAppClassLoader(Context context) throws IOException;
    public CachingWebAppClassLoader(ClassLoader parent, Context context) 
        throws IOException;
    public void clearCache();
}

ClassLoader Management

Configuration System

Pluggable configuration system for handling different aspects of web application setup.

public interface Configuration {
    void preConfigure(WebAppContext context) throws Exception;
    void configure(WebAppContext context) throws Exception; 
    void postConfigure(WebAppContext context) throws Exception;
    boolean isEnabledByDefault();
}

public class Configurations extends AbstractList<Configuration> {
    public Configurations();
    public static List<Configuration> getKnown();
    public void sort();
    public boolean configure(WebAppContext webapp) throws Exception;
}

Configuration System

Metadata and Descriptor Processing

Comprehensive metadata handling for web.xml, fragments, and annotations.

public class MetaData {
    public void setWebDescriptor(WebDescriptor descriptor) throws Exception;
    public void addFragmentDescriptor(Resource jarResource, 
        FragmentDescriptor descriptor) throws Exception;
    public void resolve(WebAppContext context) throws Exception;
    public boolean isMetaDataComplete();
}

public abstract class Descriptor {
    public Descriptor(Resource resource);
    public void parse(XmlParser parser) throws Exception;
    public Resource getResource();
}

Metadata Processing

Core Types

// Context interface for classloader operations
public interface WebAppClassLoader.Context {
    Resource newResource(String urlOrPath) throws IOException;
    PermissionCollection getPermissions();
    boolean isParentLoaderPriority();
    List<Resource> getExtraClasspath();
}

// Metadata origin tracking
public enum Origin {
    NotSet, WebXml, WebDefaults, WebOverride, 
    WebFragment, Annotation, API
}

// Fragment ordering interface
public interface Ordering {
    List<Resource> order(List<Resource> fragments);
}

Key Constants

public static final String WEB_DEFAULTS_XML = 
    "org/eclipse/jetty/ee10/webapp/webdefault-ee10.xml";

// MetaInfConfiguration constants
public static final String USE_CONTAINER_METAINF_CACHE = 
    "org.eclipse.jetty.metainf.useCache";
public static final String CONTAINER_JAR_PATTERN = 
    "org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern";
public static final String WEBINF_JAR_PATTERN = 
    "org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern";

Service Provider Integration

The module uses Java's ServiceLoader mechanism for configuration discovery:

// Automatic discovery of Configuration implementations
ServiceLoader<Configuration> loader = ServiceLoader.load(Configuration.class);
for (Configuration config : loader) {
    // Use discovered configurations
}

Built-in configuration providers include:

  • WebXmlConfiguration - Web.xml processing
  • MetaInfConfiguration - META-INF scanning
  • FragmentConfiguration - Web fragment processing
  • JettyWebXmlConfiguration - Jetty-specific configuration
  • JndiConfiguration - JNDI support
  • JaasConfiguration - JAAS authentication support
  • JaspiConfiguration - Jakarta Authentication (JASPI) support
  • JmxConfiguration - JMX management support
  • JspConfiguration - JSP support
  • ServletsConfiguration - Servlet annotation processing
  • WebAppConfiguration - Base web application configuration
  • WebInfConfiguration - WEB-INF directory processing