Hello
I'm wondering about one scenario...
Background
We have:
- org.osgi.service.http.HttpService, aka HS, which may be used to register servlets only (including "resources")
- org.ops4j.pax.web.service.WebContainer, aka WC, which may be used to register other web items - filters, listeners, welcome files, error pages, login configurations, security constraints, etc - most (if not all) items that can be declared in WEB-INF/web.xml
The problem
While this worked for a long time and is fundamental to pax-web, I see some flaws here:
- pax-web-extender-war, when parsing/processing WEB-INF/web.xml, acts in kind of "transactional" way - it uses visitor pattern "surounded" by calls to WebContainer#begin() and WebContainer#end() - this is not everything, the important check is org.ops4j.pax.web.service.internal.HttpServiceStarted#isWebAppWebContainerContext() which is a hacky way to check if we're actually inside "transaction" - it prevents starting the context after each servlet/filter/... from web.xml
- non pax-web-extender-war usage is a series of registrations - and if we register, say, 10 servlets in a row, the underlying web context is restarted 10 time (see e.g., org.ops4j.pax.web.service.undertow.internal.Context#addServlet())
The proposal
I'd like to make this behavior less implicit - so we can manually "demarcate transactioins" related to web item registration - avoiding, if possible, changes to org.ops4j.pax.web.service.WebContainer interface.
What do you think?
best regards
Grzegorz Grzybek