Fact-checked by Grok 2 weeks ago

Web container

A container is a component that hosts and manages the execution of applications, including servlets, JavaServer Pages (JSPs), and related components—typically as part of a or —by handling HTTP requests, mapping URLs to specific resources, and ensuring proper lifecycle management. Web containers extend the functionality of underlying s by providing essential services such as request and response object creation, session management (including configurable timeouts and persistence options), enforcement, transaction support, and concurrency controls to support multi-threaded operations. They interact with web server plug-ins to route servlet requests efficiently and manage the loading, initialization, and destruction of in compliance with specifications. Unlike full application servers, which also include EJB containers for enterprise beans, web containers focus primarily on web-tier components, though they may integrate with broader server environments for additional features like JNDI lookups and remote connectivity. Prominent open-source implementations of web containers include , which serves as a standalone servlet and JSP engine, and Eclipse Jetty, a lightweight embeddable container suitable for both development and production use. These containers enable developers to deploy web applications as (Web Application Archive) files, supporting standards like Servlet 6.1 and Server Pages 4.0 for dynamic content generation (as of 11 in 2024). In enterprise settings, web containers are often embedded within larger servers like or Oracle WebLogic to provide scalable, high-performance web processing.

Introduction

Definition

A web container, also known as a servlet container, is a runtime environment within a or that hosts and manages web applications, specifically handling the lifecycle of Java-based such as servlets, JavaServer Pages (JSPs), and filters. It provides the necessary infrastructure for these components to execute, including loading, instantiation, initialization, and destruction, ensuring that each servlet or filter instance is created once per declaration within the (JVM). In its role, the web container processes incoming HTTP requests by decoding MIME-based data, dispatching them to the appropriate , and formatting the corresponding responses to generate dynamic . This involves supporting protocols like HTTP/1.1 and , managing request and response objects (e.g., HttpServletRequest and HttpServletResponse), and enabling features such as buffering, headers, and asynchronous processing for efficient handling of concurrent requests. Key characteristics of a web container include thread-safe execution to support multithreading for concurrent request processing, request dispatching to route invocations correctly, and session management through mechanisms like , URL rewriting, or SSL for maintaining state across interactions. Unlike broader container technologies such as , which provide operating system-level virtualization for application isolation and deployment, a web container is specifically tailored to the ecosystem—as defined in the 6.1 specification (part of 11, released 2024)—for managing servlet-based without encompassing full OS virtualization.

Purpose and Role

A web container primarily serves to provide a standardized environment for executing server-side code, such as servlets and JavaServer Pages (JSPs), ensuring that web applications can generate dynamic content in a consistent manner across different implementations. By adhering to the Java Servlet Specification, it abstracts low-level HTTP protocol details, including request decoding, response formatting, and handling, allowing developers to focus on application logic rather than network intricacies. This setup also facilitates scalable deployment of web applications, often packaged as Web Application Archive () files, with many implementations supporting hot deployment without requiring server restarts for high-availability scenarios. In the broader web application stack, the web container acts as an intermediary layer between the front-end —such as —and the core application logic, receiving incoming HTTP requests via connectors or plugins, such as mod_jk, and dispatching them to appropriate components. It oversees critical resources, including thread pools for concurrent request handling, connection management, and session tracking through mechanisms like or URL rewriting, thereby optimizing performance and resource utilization in multi-threaded environments. This positioning enables seamless interaction with enterprise services, such as Enterprise JavaBeans (EJBs) via Java Naming and Directory Interface (JNDI), while maintaining isolation for individual s through distinct ServletContext instances. The adoption of web containers offers key benefits, including enhanced portability, as applications developed against the specification can deploy across compliant servers without modification, leveraging platform-independent Java classes. Development is simplified through standardized APIs that provide access to services like security constraints and request dispatching, reducing boilerplate code for common tasks. Furthermore, it supports modular architecture by integrating components such as filters for request preprocessing and listeners for event-driven behaviors, promoting reusable and maintainable code structures. Common use cases for web containers include dynamic content generation in platforms, where they process user interactions like product searches and transactions by integrating with backend EJBs for . They also power RESTful in applications, handling request routing and response serialization to support scalable . Additionally, in large-scale web deployments, containers enable features like for multiple sites with shared resources, ensuring efficient operation for high-traffic scenarios.

History

Origins of Servlet Technology

Servlet technology originated as an extension to the Java programming language to enable dynamic web content generation on the server side. In 1995, during the beta phase of Java 1.0, James Gosling, the lead designer of Java at Sun Microsystems, conceived the concept of servlets as a means to leverage Java's portability and object-oriented features for server-side processing, though the idea was initially set aside in favor of other priorities before being revived by the development team. The first practical implementation of servlets appeared in ' Java Web Server, originally codenamed Jeeves. Sun announced the Servlet API at the inaugural JavaOne conference in May 1996, and released the first alpha version of Java Web Server in July 1996, which included an early servlet engine for handling HTTP requests and generating dynamic responses. This marked the initial deployment of servlet technology in a production-like environment, allowing developers to write small programs that extended web server functionality without the need for external scripting. Sun formalized servlet technology with the release of the Servlet API 1.0 in December 1996, establishing the foundational specification for server-side Java components that could process requests, manage sessions, and produce responses in a standardized manner. This API version provided core interfaces like Servlet, ServletRequest, and ServletResponse, enabling consistent implementation across Java-enabled servers. The development was driven by the need to overcome limitations in existing web technologies, particularly the inefficiencies of (CGI) scripts, which required spawning a new process for each request, leading to high resource overhead and poor scalability on busy servers. Additionally, while early Java applets excelled in interactivity, they lacked robust server-side execution capabilities for generating dynamic , prompting servlets as a complementary solution for portable, thread-based server processing that integrated seamlessly with Java's .

Evolution of Web Containers

The evolution of web containers began building on early servlet concepts from the mid-1990s, progressing through standardized specifications that enhanced functionality and performance. A pivotal milestone came with Servlet 2.0 in December 1997, which introduced support for JavaServer Pages (JSP), enabling dynamic generation through a combination of servlets and template-based scripting. This integration marked a shift toward more versatile development within containers. Subsequently, Servlet 2.3 in August 2001 added filters, allowing preprocessing and postprocessing of requests and responses to improve modularity and security in web applications. Further advancements addressed scalability needs, with Servlet 3.0 in 2009 introducing asynchronous support, which permitted non-blocking I/O operations to handle long-running tasks without tying up threads, thus improving throughput in high-concurrency environments. Servlet 5.0, released in 2020 as part of 9, enhanced asynchronous processing and added support for features like server push. In 2022, 6.0 aligned with 10, introducing further refinements for modern standards. The latest, 6.1 in 2025 for 11, continues to support evolving requirements. In 2019, the platform transitioned to under the , rebranding from Java EE to foster and broader community involvement while maintaining for existing container implementations. These changes were influenced by the standardization efforts of J2EE (later Java EE), which provided a unified for applications, ensuring portability across vendors. Shifts in deployment models emerged post-2010, moving from traditional standalone servers to embedded containers, exemplified by frameworks like , which package web containers directly into executable applications for simplified development and deployment. Concurrently, Servlet 4.0 and later versions from 2017 onward emphasized reactive and non-blocking I/O, incorporating support to optimize performance for modern patterns. Cloud computing's rise imposed demands for higher efficiency and scalability, prompting container enhancements in and load balancing to support elastic infrastructures. Security improvements, such as mandatory enforcement in specifications, further fortified containers against vulnerabilities in distributed systems. As of 2025, web containers increasingly integrate with architectures, leveraging for orchestration to enable seamless scaling and fault tolerance in containerized environments. support is planned in upcoming implementations to offer reduced latency through QUIC-based transport, aligning containers with and real-time application trends.

Functionality

Core Responsibilities

A web container's primary duty involves receiving and dispatching HTTP requests to the appropriate servlets or resources within a . Upon receiving an HTTP or request from a client, the container decodes the MIME-based request, including headers and parameters, and routes it based on patterns defined in the application's configuration. This dispatching mechanism ensures that dynamic content generation occurs efficiently, often utilizing request dispatchers for forwarding or including other components like JSPs or additional servlets. Resource management forms another fundamental responsibility, enabling the container to handle multiple concurrent requests without overwhelming system resources. The container allocates threads on a per-request basis to process invocations, supporting concurrency through multi-threaded execution of servlet service methods while ensuring thread safety for shared elements like session attributes. To prevent overload, it employs techniques such as thread pooling—where a pool of threads is used to handle concurrent requests by invoking the service method on the shared servlet instance—and non-blocking I/O for scalable connection handling. These measures maintain performance under load, as seen in implementations like WebLogic Server, which tune thread pools to optimize throughput. Security enforcement is integral to the container's role, providing a secure execution for web applications. It implements and mechanisms, often through configurable realms that integrate with external stores for user credentials and roles, supporting protocols like basic, form, and digest . constraints defined in deployment descriptors or annotations are enforced via filters, restricting to protected resources and mitigating risks such as unauthorized . Additionally, the container applies declarative policies to guard against common web vulnerabilities, including injection attacks, by validating inputs and enforcing role-based permissions during request processing. Configuration handling ensures that web applications are properly initialized and deployed within the container. The container loads deployment descriptors, such as web.xml, along with annotation-based metadata like @WebServlet, to map patterns, set initialization parameters, and configure filters and listeners. Through the ServletContext, it provides centralized access to these settings, allowing applications to retrieve context-specific resources and parameters at runtime. This process aligns with the servlet lifecycle, enabling seamless startup and management of deployed components.

Servlet Lifecycle Management

In web containers, the lifecycle of a servlet is managed through three primary phases: initialization, service, and destruction, as defined by the Jakarta Servlet specification. During the initialization phase, the container loads the servlet class and creates a single instance per servlet declaration in the deployment descriptor, typically at application startup or on the first request if lazy loading is configured. The container then invokes the servlet's init(ServletConfig config) method exactly once, passing a ServletConfig object to provide configuration data such as initialization parameters and access to the ServletContext. This phase allows the servlet to allocate resources, establish database connections, or perform other setup tasks essential for operation. The service phase follows initialization and handles incoming requests throughout the servlet's active life. For each client request, the container forwards a thread to the servlet's service(ServletRequest req, ServletResponse res) method, which examines the request type (e.g., HTTP GET or POST) and delegates to appropriate methods like doGet(HttpServletRequest req, HttpServletResponse resp) or doPost. This phase supports multithreading, enabling the container to process multiple requests concurrently using the shared servlet instance, which imposes thread-safety requirements on developers to avoid race conditions in shared resources. The specification recommends designing servlets as stateless or using synchronization judiciously, often favoring pooled or immutable objects for instance variables to ensure reliability under load. Upon application shutdown or servlet removal, the destruction phase occurs, where the container calls the destroy() method once to release resources, such as closing connections, after ensuring all active request threads complete or timeout. Servlet containers also manage event handling to notify components of lifecycle changes. , implemented via interfaces like ServletContextListener for initialization and destruction events, HttpSessionListener for session creation and expiration, and ServletRequestAttributeListener for request attribute modifications, are registered in the deployment descriptor or via annotations. These listeners enable reactive behaviors, such as logging startup or cleaning up session data, and are invoked by the container at appropriate lifecycle points without blocking the primary servlet threads. Error handling is integral to lifecycle management to maintain system stability. If an exception, such as ServletException or UnavailableException, is thrown during init(), the container marks the servlet as unavailable, preventing its activation and avoiding calls to destroy() until a potential redeployment. In the service phase, exceptions may lead to graceful degradation: temporary unavailability triggers a 503 response with retry options, while permanent issues result in a response and servlet removal after destroy() invocation. This approach ensures that failures in one servlet do not cascade to the broader application context.

Architecture

Key Components

A web container's core modules form the foundation of its internal structure, enabling the execution and management of web applications based on the servlet specification. The servlet engine serves as the central processing unit, responsible for routing incoming requests to appropriate servlets and managing their invocation within the container's runtime environment. This engine operates atop a hierarchical structure of contexts, where each web application is encapsulated in a distinct servlet context, allowing multiple applications to coexist with isolated resources and configurations; for instance, virtual hosts can map network names to specific contexts, ensuring separation across applications. The servlet container handles the loading and initialization of these web applications by parsing deployment descriptors or annotations to instantiate servlets, filters, and listeners upon startup; some implementations support hot deployment for dynamic management without container restarts. Supporting elements enhance the container's modularity by providing and interception capabilities. The class loader operates on a per-context basis, prioritizing local resources from the web application's WEB-INF directory before delegating to shared or system loaders, which prevents class conflicts and ensures application in multi-tenant environments. The session manager oversees HTTP session lifecycle through the HttpSession , tracking user state via cookies, URL rewriting, or SSL sessions, with configurable timeouts and attribute storage scoped to individual contexts. Complementing this, the chain intercepts requests and responses, chaining multiple filters—configured via annotations or deployment descriptors—to perform tasks like , , or before reaching the target servlet, executed sequentially in the request processing pipeline. Memory and threading models underpin the container's efficiency in resource-constrained settings. Heap management allocates space within the JVM's heap for servlet instances and session attributes, with garbage collection handling deallocation to prevent leaks, though developers must ensure thread-safe attribute usage to avoid contention. For concurrency, the container employs a worker thread pool model, where incoming requests are dispatched to idle threads from the pool—typically configured with limits like maximum threads and queue sizes—to handle multiple simultaneous connections without blocking, aligning with the multithreaded nature of the servlet specification. Extensibility points allow customization of the container's behavior without altering core code. In implementations like , valves provide similar to filters but at the level, enabling custom request processing such as logging or for entire or . Realms offer pluggable security modules for user and , integrating with external stores like databases or LDAP, and can be nested hierarchically across , , or scopes to support flexible security policies.

Integration with Web Servers

Web containers integrate with web servers through various deployment modes to handle incoming requests efficiently and scale applications. In standalone mode, a web container like functions as a complete , directly listening on standard HTTP ports without requiring an external . This setup is suitable for simpler deployments where the container manages both static content and dynamic servlet processing. In-process deployment embeds the web container within the application's (JVM), allowing the application to start the container programmatically. This approach, common in frameworks like , packages the container with the application into a single executable file, simplifying development and deployment by eliminating the need for a separate . It enables rapid startup and is ideal for or containerized environments like , where the embedded instance runs alongside application code. Out-of-process deployment separates the and , with the server acting as a to forward requests to the container over network protocols. This mode leverages dedicated web servers like for handling static assets and load distribution, while the container focuses on dynamic content via connectors such as AJP or HTTP proxies. For instance, Apache's mod_proxy_ajp module connects to Tomcat's AJP connector, enabling efficient communication in multi-tier architectures. Web containers support standard protocols like HTTP/1.1 for basic request handling and for improved performance through multiplexing and header . The HTTP connector in , for example, natively handles both protocols, allowing seamless upgrades without configuration changes. For inter-process efficiency, binary protocols such as AJP reduce overhead compared to text-based HTTP by using compact packet formats for forwarding requests and responses between the and . AJP, designed specifically for this purpose, supports features like session affinity but requires measures such as the secret attribute to mitigate vulnerabilities; it was historically preferred in high-throughput setups, though HTTP proxies are now more commonly recommended due to AJP's risks. In clustered environments, web containers integrate with load balancers to distribute traffic across multiple instances, using mechanisms like sticky sessions to route subsequent requests from the same client to the originating node. Sticky sessions, implemented via or URL rewriting, maintain session state locality and minimize replication overhead. For , session replication synchronizes data across nodes using strategies like DeltaManager for all-to-all updates or BackupManager for primary-backup pairs, ensuring availability during node failures. Load balancers such as mod_proxy or can front these clusters, proxying traffic via AJP or HTTP while enforcing sticky routing based on JSESSIONID . Configuration for integration often includes to serve multiple from a single container instance. In , this is achieved by defining multiple elements in server.xml, each mapping a to a specific directory. For security, SSL termination typically occurs at the level, where the server decrypts traffic and forwards plaintext requests to the container over AJP or HTTP. This offloads cryptographic processing from the container, improving performance; for example, can be configured with mod_ssl to handle certificates and to without exposing the container's ports externally.

Standards and Specifications

Servlet API Evolution

The Java Servlet , a cornerstone of server-side in , has undergone steady evolution to address growing demands for performance, security, and modularity in web applications. Initially developed by , the transitioned to the (JCP) for standardization and later to the under the umbrella following Oracle's donation of Java EE in 2017. This progression has introduced enhancements in request handling, configuration, and integration with emerging protocols, ensuring the remains relevant for modern, scalable systems. Key milestones in the API's development include its foundational release and subsequent major versions that expanded functionality. Servlet 1.0, released in 1996, established the core model for basic HTTP request and response handling, enabling servlets to extend capabilities through a simple interface. By Servlet 2.4 in 2003, improvements focused on deployment descriptors, including validation for web.xml to enhance configuration reliability and integration with technologies like JSP 2.0. Servlet 3.1, released in 2013, marked a significant advance with non-blocking I/O support via interfaces like ReadListener and WriteListener, allowing asynchronous processing to improve throughput under high load. The shift to 5.0 in 2020 introduced the jakarta.* namespace to resolve trademark issues, while building on prior support for introduced in version 4.0. Major features across versions have streamlined development and bolstered security. Servlet 3.0 pioneered annotations such as @WebServlet and @WebFilter, reducing reliance on the verbose web.xml file for servlet and filter declarations, and added built-in multipart/form-data parsing for file uploads. Web fragments, also debuted in 3.0, enabled modular deployment by allowing components to contribute configuration snippets via META-INF/web-fragment.xml, facilitating pluggable extensions in large applications. Security constraints, originating in Servlet 2.2 but refined in later versions, provide declarative mechanisms for URL patterns, roles, and transport guarantees to enforce . The API maintains strong backward compatibility guarantees, with each version designed to support legacy code unless explicitly deprecated, as outlined in the specification maintenance releases. However, the namespace transition from javax.* to jakarta.* in Servlet 5.0 posed notable migration challenges, requiring updates to imports, dependencies, and third-party libraries, often involving automated tools like the Apache Tomcat Migration Tool for Jakarta EE to refactor codebases. Incomplete ecosystem support for jakarta.* at the time led to compatibility issues in mixed environments, though subsequent releases have stabilized adoption. As of 2025, Jakarta Servlet 6.1, released in April 2024 for 11, serves as the stable version, with 6.2 under development as a maintenance release for 12. Recent iterations emphasize and refinement, including deprecation of and enhanced redirect handling for better control over response status and bodies.
VersionRelease YearKey Features
1.01996Basic HTTP handling via doGet/doPost methods
2.42003 for web.xml, improved error pages
3.12013Non-blocking I/O, protocol upgrades (e.g., )
5.02020Jakarta namespace migration, default encoding
Web containers integrate the (JSP) specification to facilitate the development of dynamic by translating JSP pages into servlets during deployment or runtime. This process, outlined in the Jakarta Server Pages 4.0 specification (released April 2024 for 11), allows containers to compile JSPs into equivalent servlet classes, enabling efficient execution within the servlet environment while supporting features like custom tags and expression language for separating presentation logic from business logic. The integration ensures that JSP pages inherit the full servlet lifecycle management, with containers handling translation, compilation, and caching to optimize performance for server-side rendering of and other markup. Beyond core HTTP handling, web containers support extensions for real-time communication through the protocol, introduced in Servlet 3.1 via JSR 356, which enables full-duplex channels over a single connection for applications like chat or live updates. This builds on asynchronous processing capabilities in Servlet 3.0, allowing containers to upgrade HTTP connections to without blocking threads. Furthermore, starting with Servlet 4.0 (JSR 369), containers incorporate protocol support as per RFC 7540, facilitating , header compression, and server push to improve latency and throughput for modern web applications. In the broader Jakarta EE ecosystem, web containers interact with components like servlet filters for intercepting and modifying requests and responses, enabling cross-cutting concerns such as logging or compression across web applications. Interceptors, part of the , provide aspect-oriented capabilities for managed beans, while Contexts and (CDI 4.0) offers inversion-of-control for dependency injection, allowing containers to wire resources like databases or services into servlets and JSPs without manual instantiation. These features, supported in the Jakarta EE Web Profile 11, enhance modularity and testability in container-managed environments. For security, web containers extend support to standards like OAuth 2.0 (RFC 6749) and via extensions such as custom valves or filters that integrate with identity providers for and token-based authorization. In , the Jakarta Security specification (JSR 375) provides a pluggable that facilitates implementation of these protocols through container-provided identity stores and HTTP mechanisms. This allows developers to secure web applications against unauthorized access without embedding protocol-specific logic directly in servlets.

Implementations

Open-Source Web Containers

Open-source web containers provide community-driven implementations of Java servlet and Jakarta EE specifications, typically licensed under permissive terms like the Apache License 2.0 or Eclipse Public License, enabling free use, modification, and distribution for a wide range of applications. Apache Tomcat, donated by Sun Microsystems to the Apache Software Foundation in 1999 with its first release as version 3.0, remains one of the most popular open-source servlet containers. It supports the latest Jakarta Servlet specifications, including full compliance with Jakarta EE 11 in Tomcat 11.0.14 (as of November 2025), and is widely adopted for standalone deployments of large-scale web applications due to its straightforward configuration and reliability. Tomcat's ease of setup makes it ideal for developers seeking a simple, production-ready environment without extensive customization. Eclipse Jetty, initially developed in 1995 by Greg Wilkins at Mort Bay Consulting and moved to the in 2009, is a lightweight, embeddable servlet container known for its modularity and efficiency in resource-constrained settings. It offers robust HTTP client and server capabilities, supporting protocols such as , , HTTP/1.1, and , which enhance its suitability for modern, scalable web services. Compared to , Jetty's modular architecture allows greater flexibility for embedding in applications or tools, though it may require more configuration for complex standalone setups. Red Hat , introduced as the default in the starting with version 8 in 2013, is a high-performance, flexible web server emphasizing non-blocking I/O via NIO-based . It supports Servlet 6.0 (as of 2025), , WebSockets, and both blocking and non-blocking handlers, making it optimized for high-throughput scenarios within integrated environments like . Other implementations include Eclipse GlassFish, the official reference implementation for standards (release 7.0.24 as of April 2025), which ensures compliance testing and supports JDK versions up to JDK 24, offering a complete open-source platform for full-stack development. , forked from GlassFish in 2014, extends this foundation as an open-source compatible server with added scalability features for cloud-native deployments.

Commercial Web Containers

Commercial web containers are products designed for enterprise environments, offering robust support for EE or standards, with enhanced features for , security, and integration in large-scale deployments. These containers typically include advanced capabilities tailored for mission-critical applications, such as high-availability clustering and compliance with industry regulations. , originally developed in the mid-1990s, provides full-stack EE support, including servlet and JSP processing within its web container. It has offered clustering since early versions to enable load balancing and across multiple instances, enhancing for enterprise applications. Additionally, WebLogic includes comprehensive transaction management through its Java Transaction API (JTA) implementation, supporting distributed transactions across resources like databases and message queues. IBM WebSphere Application Server features the Liberty profile, a lightweight runtime optimized for microservices and modern applications, with fast startup times and modular feature loading to minimize resource usage. This profile supports efficient web container operations for servlet-based applications while integrating deeply with IBM mainframe systems, such as z/OS and CICS, allowing seamless access to legacy resources in hybrid environments. Other commercial offerings include Progress OpenEdge's , which provides a web container based on for deploying OpenEdge applications, featuring secure web handlers and adapters for browser-based access. These products emphasize advanced monitoring tools for performance tracking and compliance certifications, such as for cryptographic modules in secure data handling. Licensing for commercial web containers generally follows perpetual or subscription models, with metrics based on processor value units (PVUs) or named users, requiring annual support fees for updates and maintenance. Vendors provide agreements (SLAs) guaranteeing response times for issues, along with paid access to patches, fixes, and .

Comparisons

Versus Application Servers

A web container is a runtime environment limited to managing web-tier components, such as servlets and JavaServer Pages (JSP), providing services like request dispatching, session management, and security for HTTP-based applications. In contrast, a full implements the complete Java EE (now ) platform, extending beyond the web tier to include enterprise features like Enterprise JavaBeans (EJB) for business logic, Java Message Service (JMS) for asynchronous messaging, and Java Persistence API (JPA) for object-relational mapping. Pure web containers lack built-in support for advanced middleware capabilities, such as distributed transaction managers (e.g., JTA) or integrated messaging systems, requiring external integrations for enterprise-scale applications. Application servers, however, natively provide these, enabling comprehensive transaction coordination across components and reliable messaging queues without additional setup. For example, serves as a web container focused on servlet and JSP execution, suitable for simple web applications, while Oracle WebLogic acts as a full supporting the entire EE stack for complex, distributed systems. Developers often choose web containers like for resource-efficient, web-only deployments, reserving application servers like WebLogic for scenarios demanding EJB or integration. There is overlap in that many application servers embed web containers; for instance, incorporates Undertow as its servlet container to handle alongside its full Java EE capabilities.

Versus Full Web Servers

Full web servers, such as and , are designed primarily to handle HTTP requests, serve static content like , CSS, and images, and perform tasks like reverse proxying and load balancing. In contrast, web containers, also known as servlet containers, extend this functionality by providing a runtime environment for executing dynamic web components, such as Java servlets and JavaServer Pages (JSP), which generate content on-the-fly based on user input or database interactions. This core difference positions web servers as efficient handlers of unchanging resources, while web containers focus on the interpretation and processing of server-side scripts to produce personalized responses. In typical deployments, web servers manage static content delivery directly to optimize performance and security, routing only dynamic requests to the web container for processing. For instance, uses modules like mod_jk to forward servlet/JSP requests to a container like via the AJP protocol, allowing the server to retain control over static assets and SSL termination. This separation ensures that static files are served with minimal latency, as the web server avoids the additional layers required for dynamic execution. Web containers introduce performance trade-offs due to their reliance on the (JVM), which incurs overhead from startup time, memory allocation, and garbage collection compared to the lightweight, native processes of full web servers. For example, the JVM's and code cache management can increase the overall , potentially leading to higher resource usage for low-traffic static serving scenarios, though this enables scalable dynamic scripting capabilities. Despite this, optimizations like JVM tuning can mitigate impacts, making containers suitable for applications where dynamic features outweigh static efficiency. Many web containers support hybrid configurations by integrating built-in web server components, blurring the lines between the two. Apache Tomcat's Coyote connector, for instance, implements HTTP/1.1 protocol handling directly within the container, allowing it to operate as a standalone for both static files and dynamic servlets without an external . This approach simplifies deployments for development or smaller-scale production environments while maintaining compatibility with full s for larger setups.

References

  1. [1]
    Chapter 8 J2EE Containers - Oracle Help Center
    The Web Container is a J2EE container that hosts web applications. The web container extends the web server functionality by providing developers the ...Missing: definition | Show results with:definition
  2. [2]
    Modifying the default web container configuration - IBM
    A web container handles requests for servlets, JavaServer Pages (JSP) files, and other types of files that include server-side code.<|control11|><|separator|>
  3. [3]
    1.4 Java EE Containers - Java Platform, Enterprise Edition
    Web container: Manages the execution of web pages, servlets, and some EJB components for Java EE applications. Web components and their container run on the ...
  4. [4]
    WebSphere Application Server: Overview - IBM
    The web container is the part of the application server in which web application components run. Web applications are comprised of one or more related servlets, ...
  5. [5]
    A Minimalistic User's Guide - Apache Tomcat
    Tomcat is a servlet container with a JSP environment. A servlet container is a runtime shell that manages and invokes servlets on behalf of users.
  6. [6]
    WebContainer (JSP/Servlet) - Apache Karaf
    Aug 1, 2021 · Apache Karaf can act as a complete WebContainer, fully supporting the JSP/Servlet specifications. Apache Karaf WebContainer supports both:
  7. [7]
    2 Understanding Web Applications, Servlets, and JSPs
    The Web Applications Container. A Web application contains an application's resources, such as servlets, JavaServer Pages (JSPs), JSP tag libraries, ...
  8. [8]
    Jakarta Servlet Specification
    A servlet is a Jakarta technology-based web component, managed by a container, that generates dynamic content. It is a platform-independent Java class.
  9. [9]
    [PDF] Java™ Servlet Specification
    "This is an implementation of an early-draft specification developed under the Java Community Process (JCP) and is made available for testing and evaluation.
  10. [10]
    1 Servlet Overview
    The servlet container provides the servlet easy access to properties of the HTTP request, such as its headers and parameters. When a servlet is called (such as ...
  11. [11]
    Configuring J2EE Containers
    The primary role of the web container is to provide a run-time environment for web applications and provide services (database access, security, multi-threading ...
  12. [12]
    2 - C H A P T E R - - Oracle Help Center
    As shown in FIGURE 2-1, a web application runs inside a servlet container. A servlet container, in turn, is contained within a web server. Each web application ...
  13. [13]
    Servlets and Tomcat: 23+ Years and Counting - Tomitribe
    Jan 16, 2020 · The Servlet API made its debut at JavaOne in May of 1996. Two months later, Sun released the first alpha of Jeeves, later named Java Web Server, ...
  14. [14]
    Jakarta EE: Servlets and Tomcat — 23 Years and Counting
    The Servlet API made its debut at JavaOne in May 1996. Two months later, Sun released the first alpha of Jeeves, later named Java Web Server, with the new ...
  15. [15]
    Java Servlet Version History and Important Changes - CodeJava.net
    Sep 6, 2024 · Java Servlet 2.0 (December 1997): ; Introduction: First official release of Java Servlets as part of the Java Enterprise Edition (Java EE). ; Key ...
  16. [16]
    Java Servlet Technology
    Initially, Common Gateway Interface ( CGI ) scripts were the main technology used to generate dynamic content. Though widely used, CGI scripting technology has ...
  17. [17]
    [PDF] Java™ Servlet Specification Version 2.3 - Java Community Process
    Defines a set of methods that a servlet uses to communicate with its servlet container, for example, to get the ... servlet container and web server. The Deployer ...
  18. [18]
    Jakarta EE Releases | The Eclipse Foundation - Jakarta® EE
    September 10, 2019. Jakarta EE 8 Released! The Jakarta EE 8 release is here, the future of Java EE. Download compatible products and see what's new in the ...Jakarta EE 10 · The Eclipse Foundation · Jakarta EE 11 · Jakarta EE 8Missing: transition | Show results with:transition
  19. [19]
  20. [20]
    17.13 Nonblocking I/O - Java Platform, Enterprise Edition
    Java EE provides nonblocking I/O support for servlets and filters when processing requests in asynchronous mode.Missing: reactive 2017
  21. [21]
    5 Game-Changing Trends for 2025: Kubernetes Leads the Way
    Jan 8, 2025 · Kubernetes will emerge as the standard for orchestrating both VMs and containers, unifying cloud and on-premises environments under one API interface.
  22. [22]
    Web Application Architecture: The Latest Guide (2025 AI Update)
    Future-proof your 2025 web application architecture with AI integrations, serverless computing & microservices, and best security practices.
  23. [23]
    Controlling Concurrent Access to Shared Resources
    A web container can implement this guarantee by synchronizing access to a single instance of the servlet, or by maintaining a pool of web component instances ...
  24. [24]
    Tuning WebLogic Server
    If your Thread Pool Size is set too high when running WebLogic Server under maximum load, your performance increases as you decrease the number of threads.<|control11|><|separator|>
  25. [25]
    Adding Authentication Mechanisms to the Servlet Container
    The Enterprise Server includes implementations of a number of HTTP layer authentication mechanisms such as basic, form, and digest authentication.
  26. [26]
    Overview of Web Application Security - Oracle Help Center
    A web container provides services such as request dispatching, security, concurrency, and life-cycle management. Certain aspects of web application security can ...
  27. [27]
    Servlet (Java(TM) EE 7 Specification APIs) - Oracle Help Center
    A servlet is a small Java program that runs within a Web server. Servlets ... Called by the servlet container to allow the servlet to respond to a request.<|control11|><|separator|>
  28. [28]
    Jakarta Servlet Specification
    Summary of each segment:
  29. [29]
    Apache Tomcat 9 Architecture (9.0.111) - Architecture Overview
    Oct 10, 2025 · A Service is an intermediate component which lives inside a Server and ties one or more Connectors to exactly one Engine.
  30. [30]
  31. [31]
  32. [32]
  33. [33]
  34. [34]
  35. [35]
    Apache Tomcat 9 Configuration Reference (9.0.111) - The Valve ...
    Oct 10, 2025 · A Valve element is inserted into the request processing pipeline for the associated Catalina container, with distinct processing capabilities.Access Logging · Single Sign On Valve · Authentication · Error Report Valve
  36. [36]
    What Is Embedded Tomcat? Definition from TheServerSide
    Oct 15, 2021 · An embedded Tomcat server consists of a single Java web application along with a full Tomcat server distribution, packaged together and compressed into a ...
  37. [37]
    Apache Tomcat 9 Configuration Reference (9.0.111) - The AJP ...
    Oct 10, 2025 · The AJP Connector element represents a Connector component that communicates with a web connector via the AJP protocol.Missing: standalone | Show results with:standalone
  38. [38]
    Let's speak AJP - Doyensec's Blog
    Nov 15, 2022 · AJP (Apache JServ Protocol) is a binary protocol developed in 1997 with the goal of improving the performance of the traditional HTTP/1.1 protocol.
  39. [39]
    Apache Tomcat 9 (9.0.111) - Clustering/Session Replication How-To
    Oct 10, 2025 · Tomcat can perform an all-to-all replication of session state using the DeltaManager or perform backup replication to only one node using the BackupManager.Cluster Basics · Overview · Cluster Information · Bind session after crash to...
  40. [40]
    Apache Tomcat 9 (9.0.111) - SSL/TLS Configuration How-To
    Oct 10, 2025 · To configure SSL/TLS in Tomcat, create a keystore, uncomment the SSL connector, and modify the configuration file. SSL/TLS encrypts data during ...
  41. [41]
    Java Specification Requests - detail JSR# 154
    JSR 154: JavaTM Servlet 2.4 Specification. Stage, Access, Start, Finish. Maintenance Release 2, Download page, 11 Sep, 2007. Maintenance Draft Review 6 ...
  42. [42]
  43. [43]
    Jakarta Servlet 5.0 | Jakarta EE | The Eclipse Foundation
    Jakarta Servlet defines a server-side API for handling HTTP requests and responses. Jakarta Servlet 5.0 Release Record · Jakarta EE Platform 9 Release Plan.Missing: history | Show results with:history
  44. [44]
  45. [45]
    Apache Tomcat® - Migration Guide - Tomcat 10.0.x
    Tomcat can convert an existing web application from Java EE 8 to Jakarta EE 9 at deployment time using the Apache Tomcat migration tool for Jakarta EE. To ...Migrating from 9.0.x to 10.0.x · Specification APIs<|control11|><|separator|>
  46. [46]
    Jakarta Servlet 6.1 | projects.eclipse.org
    Download Jakarta Servlet 6.1. The plan for 6.1 is: Release Date Friday, April 5, 2024 - 12:00. Release Type Minor release.
  47. [47]
    Jakarta Servlet 6.2 (Under Development) | The Eclipse Foundation
    Jakarta Servlet defines a server-side API for handling HTTP requests and responses. This release is a maintenance release that will review the open enhancement ...
  48. [48]
    Jakarta Server Pages
    Jakarta Server Pages (JSP) is the Jakarta EE technology for building applications for generating dynamic web content, such as HTML, DHTML, XHTML, and XML.
  49. [49]
    Understanding Web Applications, Servlets, and JSPs
    Jakarta Server Pages (JSPs) are defined by a specification for combining Java with HTML to provide dynamic content for Web pages. When you create dynamic ...
  50. [50]
    [PDF] WebSocket on Servlet 3.1 - Apache Tomcat
    Apr 9, 2014 · • Feature added in Servlet 3.0. • Implement ServletContainerInitializer. • Add @HandlesTypes. • When web application starts the container calls.
  51. [51]
    [PDF] Java™ Servlet Specification
    from the date of Release listed above; (b) the date on which the final version of the Specification is publicly released; or (c) the date on which the. Java ...
  52. [52]
    Jakarta Contexts and Dependency Injection
    Mar 9, 2022 · CDI 4.0 splits the CDI core into Lite and Full. Lite contains a subset of original features which are designed to work in more restricted environments.<|control11|><|separator|>
  53. [53]
    Jakarta EE Web Profile
    Mar 10, 2025 · The container provides a filter with the name "CDI Conversation Filter", which may be mapped in web.xml , allowing the user alter when the ...
  54. [54]
    Apache Tomcat® - Welcome!
    ### Summary of Apache Tomcat Content
  55. [55]
    The Eclipse Jetty Project :: Eclipse Jetty
    ### Summary of Eclipse Jetty Project
  56. [56]
    Apache Tomcat® - Heritage
    The Tomcat code base was donated by Sun to the Apache Software Foundation in 1999, and the first Apache Tomcat® release was version 3.0.Missing: inception date
  57. [57]
    Apache Tomcat vs Eclipse Jetty: Top Differences - GeeksforGeeks
    Jul 23, 2025 · Jetty benefits from the support of the Eclipse Foundation, and while its community might not be as extensive as Tomcat's, it is dynamic and ...
  58. [58]
    “Tech Preview”: Undertow - Red Hat
    And that leads us to JBoss Undertow. Undertow became the new web server for the Wiildfly project starting in version 8. Previous versions of Wildfly and JBoss ...
  59. [59]
    Undertow · JBoss Community
    ### Summary of Undertow (https://undertow.io/)
  60. [60]
    Eclipse GlassFish
    ### Summary of Eclipse GlassFish
  61. [61]
  62. [62]
    What is WebLogic Server? How does it work? - TechTarget
    Dec 23, 2021 · History of WebLogic · 1995: WebLogic, Inc. founded. · 1997: First release of WebLogic Tengah. · 1998: WebLogic, Inc., acquired by BEA Systems.
  63. [63]
    Oracle WebLogic Server Technical Information
    Oracle WebLogic Server is the industry leading application server for building enterprise applications using Java EE standards.
  64. [64]
    Understanding WebLogic Server Clustering - Oracle Help Center
    A WebLogic Server cluster consists of multiple WebLogic Server instances running simultaneously and working together to provide increased scalability and ...Missing: history | Show results with:history
  65. [65]
    7, "Transaction Management
    This chapter describes the system-level transaction management contract that is used for outbound communication from WebLogic Server to Enterprise Information ...
  66. [66]
    WebSphere Application Server Liberty overview - IBM
    Liberty is a lightweight Java™ runtime that is ideal for building microservices, modern monolithic applications, and anything in between.Missing: mainframe | Show results with:mainframe
  67. [67]
    WebSphere Application Server's Legacy and Future on z/OS
    Oct 13, 2025 · Liberty is a lightweight, modular version of WAS. On z/OS, Liberty merges CR and SRs into a single JVM, reducing startup time and resource usage ...
  68. [68]
    [PDF] TIBCO BusinessWorks™ Container Edition Concepts
    Process-oriented - provides real-time integration for endpoints such as application. APIs and adapters, and uses APIs, objects, and messages for data ...
  69. [69]
    What is Progress OpenEdge Application Server? - eG Innovations
    Progress OpenEdge Application Server is efficient, scalable, secure and easy to install and manage. Progress applications are packaged as Web application ...
  70. [70]
    [PDF] Enhance Your Enterprise Security with Progress OpenEdge 12.8
    The top features include: • Dynamic Data Masking. • Transparent Data Encryption. • Hardware Security Module. • OpenSSL and TLS 1.3. • Enhanced Application ...
  71. [71]
    [PDF] Oracle Software Licensing Basics
    As of September 1, 2020, Oracle has ended the availability of term licenses for all on-premise software with the exception of specific Oracle Technology ...
  72. [72]
    IBM WebSphere Licensing and Costs: Overdeployment and ...
    Jul 26, 2025 · Support/Maintenance Fees: IBM annual support (Subscription & Support) typically adds about 20-25% of the license cost every year. Over the ...IBM WebSphere Licensing... · Understanding IBM... · Optimizing IBM WebSphere...
  73. [73]
    2.2 Java EE Servers and Containers - Oracle Help Center
    The web container is the interface between web components and the web server. ... The application client container is the interface between Java EE application ...
  74. [74]
    Overview :: Jakarta EE Tutorial
    Web components and their container run on the Jakarta EE server. Application client container: Manages the execution of application client components.<|control11|><|separator|>
  75. [75]
    Chapter 17. Configuring the Web Server (Undertow)
    The undertow subsystem allows you to configure the web server and servlet container settings. It implements the Jakarta Servlet 4.0 Specification as well as ...
  76. [76]
    Reference Guide (1.2.50) - Configuring mod_jk for the Apache HTTP ...
    Aug 13, 2024 · The directive JkOptions allow you to set many forwarding options which will enable (+) or disable (-) following option. Without any leading signs, options will ...
  77. [77]
    Chapter 2. Apache Tomcat Connector (mod_jk) | 2.4.29
    The Apache Tomcat Connector (mod_jk) is a plug-in for forwarding requests from Apache HTTP Server to a Servlet container and supports load balancing.
  78. [78]
    Memory footprint of the JVM - Spring
    Mar 11, 2019 · The JVM divides its memory into two main categories: heap memory and non-heap memory. Heap memory is the part with which people are typically ...Two Kinds Of Memory · Native Memory Areas · Sizing The Jvm
  79. [79]
    The Apache Tomcat 5.5 Servlet/JSP Container - Proxy Support HOW ...
    You can improve performance by using the mod_jk web connector instead of mod_proxy . mod_jk can be configured so that the web server serves static content ...
  80. [80]
    The Coyote HTTP/1.1 Connector - Apache Tomcat
    It enables Catalina to function as a stand-alone web server, in addition to its ability to execute servlets and JSP pages. A particular instance of this ...Missing: hybrid | Show results with:hybrid