<div dir="ltr"><div>Hi,</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I think what you&#39;re asking for is to intercept at the container level and change how they initialize. I&#39;m curious, under what cases do you not have an active request?<br></blockquote><div><br></div><div>My primary case is to compensate for container differences regarding a ServerAuthModule (JSR 196/JASPIC). Such ServerAuthModule is called before the first Servlet Filter is, and gets an HttpServletRequest passed in. In many servers (JBoss, GlassFish, TomEE) the CDI default scopes (request, session, etc) are active at that point, but not in all (Liberty, WebLogic).</div><div><br></div><div>With this proposed API a library such as Soteria could possibly start those scopes earlier on Liberty and WebLogic and do nothing on JBoss, GlassFish and TomEE.</div><div><br></div><div>Kind regards,</div><div>Arjan Tijms</div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">In addition, I think you&#39;re looking for the equivalent of Context.isActive. Part of me even wonders if swapping around the impl to be Context.activate() and Context.deactivate() may be better from a domain standpoint. <br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">What I&#39;m looking for is a way to start contexts possibly earlier than a specific container implementation normally starts them, and stop them possibly later. If the context is started earlier in say a request, then eventually the container will also start that same context later in the request. If that will throw an exception the request will not proceed, which is of course not intended.<br>Likewise, when the container stops the context this will thus be too early.<br>With a wrapped context controller, the startContexts and stopContexts calls can be ignored for those contexts the application (extension/library) wanted to start earlier and stop later. This does of course assume that the container itself will also use this context controller instead of the current proprietary code.<br>Additionally, the PR does not contain the check anymore to see if the context is already active or already stopped. Is that still intended to be added? This would be particularly useful for code that needs to be portable between different containers, where one container may already have started the context at a given point, where another container has not (catching the exception would be an alternative here but is obviously not so nice).<br>Another point, what about letting the caller of the startContexts method optionally pass in the objects (or a lambda to obtain them) on which that context primarily depends (if any). E.g. for the request scope, pass in an HttpServletRequest instance.</blockquote></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Would it be an idea to set a wrapped (or decorated) context controller?<br></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br></blockquote></div><div class="gmail_extra"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">On Sun, May 15, 2016 at 6:33 PM, John D. Ament <span dir="ltr">&lt;<a href="mailto:john.d.ament@gmail.com" target="_blank">john.d.ament@gmail.com</a>&gt;</span> wrote:</blockquote></div><div class="gmail_extra"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">All,</blockquote></div><div class="gmail_extra"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I&#39;ve started a PR for API changes to support starting/stopping the built in contexts, which you can find here: <a href="https://github.com/cdi-spec/cdi/pull/291/files" target="_blank">https://github.com/cdi-spec/cdi/pull/291/files</a></blockquote></div><div class="gmail_extra"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">It&#39;s visibly based on what is in DeltaSpike&#39;s CDI Ctrl plus some of the external stuff (e.g. <a href="https://github.com/apache/deltaspike/blob/master/deltaspike/modules/scheduler/api/src/main/java/org/apache/deltaspike/scheduler/api/Scheduled.java#L40" target="_blank">https://github.com/apache/deltaspike/blob/master/deltaspike/modules/scheduler/api/src/main/java/org/apache/deltaspike/scheduler/api/Scheduled.java#L40</a> ) so I&#39;d like to get some input.</blockquote></div><div class="gmail_extra"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I don&#39;t suspect that this will be an SE only feature, today I use programmatic context starting even while on an app server.  Even though I&#39;m not using whats provided in DS, it was identified as a clear cross cutting concern hence why there&#39;s an interceptor as well.</blockquote></div><div class="gmail_extra"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">John</blockquote></div><div class="gmail_extra"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">_______________________________________________</blockquote></div><div class="gmail_extra"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
cdi-dev mailing list</blockquote></div><div class="gmail_extra"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a></blockquote></div><div class="gmail_extra"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a></blockquote></div><div class="gmail_extra"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (<a href="http://www.apache.org/licenses/LICENSE-2.0.html" rel="noreferrer" target="_blank">http://www.apache.org/licenses/LICENSE-2.0.html</a>). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.</blockquote></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br></blockquote></div></div></blockquote><div class="gmail_extra"><br></div></div>