Historically, the CDI specification defined how CDI scopes such as the RequestScope and the SessionScope had to behave for Servlets.
In CDI 4.1 this specification text was pushed out (see https://jakarta.ee/specifications/cdi/4.1/ "Delegate integration requirements to the Jakarta Platform specifications"), following CDI's stated goal of being a foundational bean model and not a framework or facade building or augmenting other specs.
In EE 11 we were running out of time and the, more or less orphaned, spec text was put in the platform specification (see e.g. https://jakarta.ee/specifications/platform/11/jakarta-platform-spec-11.0#builtin_contexts_ee), but it's not seen as its proper home (see jakartaee/platform#1246 (comment))
I'd like to propose adding a new section, 15.6, to define the behaviour for the CDI build-in contexts for Servlet.
The section would start much like the other sections in 15 already do.
E.g. as a draft, based on the existig spec that was moved from CDI:
_"In a product that supports Contexts and Dependency Injection (CDI) for Jakarta EE Platform, and in which CDI is enabled for the web application, the container MUST support the CDI built-in request, session, and application contexts during servlet processing as defined in this section.
The request context is active:
during the service() method of any servlet in the web application, during the doFilter() method of any servlet filter and when the container calls any ServletRequestListener or AsyncListener
[...]"_
Alternatively, we could also fold 15.5.16 into a new section and more generally call it "Contexts and Dependency Injection":
- 15.6 Contexts and Dependency Injection
- 15.6.1 General CDI requirements
Move current 15.5.16 here.
- 15.6.2 Built-in CDI contexts during servlet processing
- 15.6.2.1 Request context lifecycle
- 15.6.2.2 Session context lifecycle
- 15.6.2.3 Application context lifecycle
Historically, the CDI specification defined how CDI scopes such as the RequestScope and the SessionScope had to behave for Servlets.
In CDI 4.1 this specification text was pushed out (see https://jakarta.ee/specifications/cdi/4.1/ "Delegate integration requirements to the Jakarta Platform specifications"), following CDI's stated goal of being a foundational bean model and not a framework or facade building or augmenting other specs.
In EE 11 we were running out of time and the, more or less orphaned, spec text was put in the platform specification (see e.g. https://jakarta.ee/specifications/platform/11/jakarta-platform-spec-11.0#builtin_contexts_ee), but it's not seen as its proper home (see jakartaee/platform#1246 (comment))
I'd like to propose adding a new section, 15.6, to define the behaviour for the CDI build-in contexts for Servlet.
The section would start much like the other sections in 15 already do.
E.g. as a draft, based on the existig spec that was moved from CDI:
_"In a product that supports Contexts and Dependency Injection (CDI) for Jakarta EE Platform, and in which CDI is enabled for the web application, the container MUST support the CDI built-in request, session, and application contexts during servlet processing as defined in this section.
The request context is active:
during the service() method of any servlet in the web application, during the doFilter() method of any servlet filter and when the container calls any ServletRequestListener or AsyncListener
[...]"_
Alternatively, we could also fold 15.5.16 into a new section and more generally call it "Contexts and Dependency Injection":
Move current 15.5.16 here.