<div dir="ltr">Hi,<div><br></div><div>The CDI spec defines a built-in bean for the type HttpServletRequest. In 3.8 it says:</div><div><br></div><div><div>&quot;A servlet container must provide the following built-in beans, all of which have qualifier @Default:</div><div><br></div><div>a bean with bean type javax.servlet.http.HttpServletRequest, allowing injection of a reference to the HttpServletRequest&quot;</div></div><div><br></div><div>An HttpServletRequest however can be wrapped multiple times and by multiple artefacts. I.e. by a ServerAuthModule, Filter and a RequestDispatcher.</div><div><br></div><div>The question now is; which version of the HttpServletRequest is supposed to be injected?</div><div><br></div><div>* The first one in the chain?</div><div>* The last one in the chain?</div><div>* The current one at a given point in the chain?</div><div><br></div><div>A little bit of experimenting seems to indicate it&#39;s now often &quot;one of the first ones&quot;, e.g. the one that happened to be current when e.g. a ServletRequestListener that initialises a specific CDI implementation is called.</div><div><br></div><div>I think this is a little confusing, as working with an injected request can now totally ignore the request wrapping that has been done and break an application badly.</div><div><br></div><div>Thoughts?</div><div><br></div><div>Kind regards,</div><div>Arjan Tijms</div><div><br></div></div>