LLMpediaThe first transparent, open encyclopedia generated by LLMs

Jakarta Servlet

Generated by GPT-5-mini
Note: This article was automatically generated by a large language model (LLM) from purely parametric knowledge (no retrieval). It may contain inaccuracies or hallucinations. This encyclopedia is part of a research project currently under review.
Article Genealogy
Parent: Jakarta EE Hop 4
Expansion Funnel Raw 33 → Dedup 0 → NER 0 → Enqueued 0
1. Extracted33
2. After dedup0 (None)
3. After NER0 ()
4. Enqueued0 ()
Jakarta Servlet
NameJakarta Servlet
Initial release1997
DeveloperSun Microsystems; now Eclipse Foundation
Latest releaseJakarta Servlet 6.0 (API aligned with Jakarta EE 10)
Written inJava (programming language)
PlatformJava Platform, Enterprise Edition / Jakarta EE
LicenseEclipse Public License / open source
WebsiteEclipse Foundation

Jakarta Servlet is a server-side component model and API specification for handling Hypertext Transfer Protocol requests and generating responses in Java (programming language) web applications. It defines a contract for pluggable components that process HTTP traffic inside web server and application server environments, enabling integration with technologies such as JavaServer Pages, WebSocket, and Jakarta RESTful Web Services. The specification is governed by the Eclipse Foundation as part of the Jakarta EE platform and is implemented by multiple vendors and open-source projects.

Overview

The specification specifies interfaces and abstract classes that allow developers to write reusable components executed by a servlet container embedded in servers like Apache Tomcat, Eclipse Jetty, GlassFish, and WildFly. Servlets operate within a container-managed runtime that provides lifecycle management, threading, concurrency, session management, and integration with Java Naming and Directory Interface for resource lookup. Jakarta Servlet is central to the Jakarta EE web tier, interoperating with APIs such as Jakarta Expression Language, Jakarta Faces, and Jakarta Security to build enterprise web applications.

History and Evolution

The technology originated under Sun Microsystems during the late 1990s as part of the original Java Platform, Enterprise Edition efforts. Early iterations standardized servlet behavior across containers, enabling portability across implementations like Apache Tomcat and Jetty. Following the corporate restructuring surrounding Oracle Corporation and subsequent vendor collaborations, stewardship moved to the Eclipse Foundation and the branding transitioned as part of the Jakarta EE initiative. Major milestones include alignment with newer HTTP features, modularization for Java Platform Module System, and package namespace migration to support the Jakarta EE trademark and ecosystem.

Architecture and Components

A servlet-based web application is composed of servlets, filters, listeners, and deployment descriptors. The servlet container (often inside an application server such as GlassFish or a servlet engine like Apache Tomcat) provides request routing, multithreaded execution, and lifecycle callbacks. Filters offer request/response transformation points integrated into the pipeline, while listeners receive container events from components such as HttpSession and application startup. Configuration can be expressed in deployment descriptors or programmatic registration using container APIs, enabling integration with component models such as OSGi in modular environments.

Core APIs and Interfaces

Key types in the specification include the servlet interface hierarchy and HTTP-specific contracts. The foundational types include javax.servlet equivalents migrated under the Jakarta namespace and define entities such as generic servlet base classes, HTTP request and response wrappers, session abstractions, and context objects. Important interfaces and classes used across implementations include servlet context, request dispatcher, session management APIs, and multipart request support. These APIs are designed to interoperate with other Jakarta EE specs including Jakarta Transactions, Jakarta Persistence, and Jakarta Security for enterprise concerns like transaction propagation and authentication.

Lifecycle and Request Handling

The container controls the lifecycle: loading, initialization, request servicing, and destruction. Servlets receive initialization parameters and are instantiated once (or managed via pooling) before the container invokes service methods for each request thread. For HTTP processing, the container dispatches requests to doGet, doPost, and related handlers, providing access to headers, cookies, input streams, and asynchronous processing primitives. Asynchronous request handling and non-blocking IO support allow integration with server push and streaming scenarios, while session lifecycle events let applications react to user session creation, passivation, and invalidation. Request dispatch mechanisms include forwarding and including resources via request dispatcher semantics.

Security and Configuration

Security features integrate container-managed authentication, authorization, and transport guarantees. The specification defines programmatic and declarative configuration points for role-based access constraints, security realms, and login mechanisms that integrate with container providers such as Keycloak or platform-native realms. Configuration options include deployment descriptors, annotations, and runtime container administration tools; these control aspects such as URL pattern mapping, multipart file upload constraints, and initialization parameters. Secure coding guidance recommends explicit input validation, proper session invalidation, and adherence to container-provided mechanisms for credential handling and TLS termination.

Implementations and Compatibility

Multiple servlet containers and application servers implement the specification, including Apache Tomcat, Eclipse Jetty, GlassFish, WildFly, and commercial vendors like IBM WebSphere variants and Oracle WebLogic Server. Compatibility is maintained via TCK-driven conformance testing overseen within the Jakarta EE community at the Eclipse Foundation. Versions of the specification evolve to reflect modern web standards and Java language changes, and implementers provide extensions for performance, clustering, and management features such as JMX integration or native session replication. Migration paths exist from legacy javax namespaces to Jakarta namespaces, and tooling in build ecosystems like Maven (software) and Gradle assists projects in targeting specific container distributions and API versions.

Category:Jakarta EE Category:Java (programming language)