Repository navigation
Conversation
The new services/web module provides a web container simpler than Pax Web, embedding Apache Tomcat 11 (Servlet 6.1). It supports the OSGi Servlet Whiteboard (servlets, filters, listeners, resources and servlet context helpers) and the Web Application Bundles (web.xml, web fragments, annotations, ServletContainerInitializer, Karaf JAAS authentication). It is configured with the org.apache.karaf.services.web PID and provides the web:context-list, web:servlet-list and web:filter-list commands. The karaf-web feature is added to the standard features and installed in the karaf-light distribution. The manual gets a new chapter, and itests cover the feature installation and a whiteboard servlet.
jbonofre
force-pushed
the
karaf-web-tomcat
branch
from
October 18, 2026 04:21
9dcffd3 to
d73d39d
Compare
The content length of the test resource depends on the line ending of the checkout, \r\n on Windows with core.autocrlf.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds
karaf-web, a web container simpler than Pax Web, based on an embedded Apache Tomcat 11 (Servlet 6.1, Java 17).The
services/webmoduleThe
org.apache.karaf.services.webbundle embeds Tomcat privately (Tomcat logs to the Karaf log via theorg.apache.juli.loggingpackage of Pax Logging) and supports:org.osgi.service.servlet, the Jakarta version of the HTTP Whiteboard): servlets, filters (patterns, servlet names, regex, dispatchers), listeners, resources and servlet context helpers (custom contexts,handleSecurity, resources, MIME types). Shadowing by name/pattern and ranking, with the services not deployed reported with the reason. Services registered together are deployed together (100 ms debounce); the unregistration of a service waits for its undeployment.Web-ContextPath): resources read from the bundle entries, classes loaded by the bundle class loader,web.xml, web fragments,@WebServlet/@WebFilter/@WebListener,ServletContainerInitializer, default servlet and welcome files, authentication with the Karaf JAAS realm, and theServletContextservice with theosgi.web.*properties.org.apache.karaf.services.webPID: host, HTTP/HTTPS ports, keystore, max threads, session timeout, JAAS realm, undeploy timeout. A configuration change restarts Tomcat.web:context-list,web:servlet-listandweb:filter-list.Not supported: JSP, WAR deployment (
war:/webbundle:), whiteboard error pages and preprocessors,osgi.http.whiteboard.target,HttpServiceRuntime, and thejavaxOSGi HTTP Service.Distribution
karaf-webfeature in the standard features (the Servlet API and theorg.apache.karaf.services.webbundle).karaf-webis an installed feature of the karaf-light distribution (feature:install karaf-web), not a boot feature.karaf-webis an alternative to the Pax Web features: they use the same default port and the sameweb:*command names, so they should not be installed together.Tests
KarafWebTestitest (context list, whiteboard servlet deployment and synchronous undeployment) andStandardFeaturesTest#installKarafWebFeature.web.xml, annotations and BASIC authentication, HTTPS with a PKCS12 keystore, configuration changes, Karaf restart and feature uninstall.MavenTestfails onmainalready (no version forjakarta.servlet/jakarta.servlet-api); with the Servlet API dependency added to the itests it gets further, but it then fails to loadKarafTestSupportin its probe, a separate issue.