<div dir="ltr">Thank you Martin! I think if I specifiy a class level interceptor, service(ServiceRequest, ServletResponse) will be intercepted but not doGet(), as doGet will be called by .service(ServletRequest, ServletResponse) directly not via a proxy. Did I miss anything?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 15, 2015 at 11:45 AM, Martin Kouba <span dir="ltr">&lt;<a href="mailto:mkouba@redhat.com" target="_blank">mkouba@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dne 13.5.2015 v 00:27 Emily Jiang napsal(a):<span class=""><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thank you Jozef for the helpful info. I have another question on<br>
interceptor:<br>
EE7 spec states the JavaEE component classes, listed in Table EE.5-1,<br>
need to support interceptors. Take servlet for an example, which methods<br>
can be intercepted?<br>
<br>
As the servlet classes are invoked by the container, according to CDI1.2<br>
spec, it seems only service(ServletRequest, ServletResponse) can be<br>
intercepted. No other methods can be intercepted.<br>
<br>
Normally customer applications override doPost or doGet, but they cannot<br>
be intercepted. I cannot see any value of support interceptors on<br>
Servlet. Anything I missed?<br>
</blockquote>
<br></span>
The serlet container always invokes Servlet.service(ServletRequest, ServletResponse)() which delegates to one of those convenient methods (doGet() etc.) in case of javax.servlet.http.HttpServlet. So if you extend HttpServlet and only override doGet() it would be &quot;intercepted&quot; if you annotate the servlet class with an interceptor binding. If you only annotate the doGet() method an interceptor will not be invoked.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
On Tue, May 12, 2015 at 7:50 AM, Jozef Hartinger &lt;<a href="mailto:jharting@redhat.com" target="_blank">jharting@redhat.com</a><br></span><div><div class="h5">
&lt;mailto:<a href="mailto:jharting@redhat.com" target="_blank">jharting@redhat.com</a>&gt;&gt; wrote:<br>
<br>
    On 05/11/2015 03:47 PM, Emily Jiang wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
    I have a few questions on interceptors:<br>
<br>
    1. CDI Interceptors on cdi beans<br>
    Will the interceptors share the same creational context as the<br>
    bean it is associated with?<br>
</blockquote>
    Yes. It is not the very same creational context but a new one with a<br>
    parent-child relationship to the one of the associated bean. This is<br>
    the same as for @Dependent dependencies<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    Will Weld managed the cdi interceptors as well as the old-styled<br>
    interceptors?<br>
</blockquote>
    Yes, Weld manages interceptor bindings associated using interceptor<br>
    bindings as well as those associated using @Interceptors<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    @Interceptors don&#39;t work on other cdi beans except ejb and managed<br>
    beans, right?<br>
</blockquote>
    &quot;Managed bean&quot; is ambiguous. Weld support interceptors on all CDI<br>
    managed beans (not on producer fields/methods nor extension-provided<br>
    beans).<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
    2. Interceptors on ejb beans or managed beans<br>
    I think the integrator needs to create these @Interceptors and cdi<br>
    interceptors.<br>
</blockquote>
    Yes, for EJBs and EE managed beans it is integrator&#39;s job to handle<br>
    those. Weld can handle @AroundConstruct interceptors if needed. I&#39;ve<br>
    updated the docs on this topic recently:<br>
    <a href="https://github.com/jharting/core/blob/a1eb6194be36ded86dc9709c6767f5016fb98997/docs/reference/src/main/asciidoc/ri-spi.asciidoc#around-construct-interception" target="_blank">https://github.com/jharting/core/blob/a1eb6194be36ded86dc9709c6767f5016fb98997/docs/reference/src/main/asciidoc/ri-spi.asciidoc#around-construct-interception</a><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    Will these interceptors use the non-contextual creational context<br>
    (scope @Dependent) or use the ejb or managed bean&#39;s creational<br>
    context?<br>
</blockquote>
    ejb or managed bean&#39;s creational context<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
    Will Weld destroy the interceptors when the associated beans are<br>
    destroyed or the integrator need to destroy them? This logic<br>
    applicable to both cdi interceptors and @Interceptors style<br>
    interceptors, right?<br>
</blockquote>
    Any time the parent (bean&#39;s) creational context is destroyed, the<br>
    children creational contexts (interceptors&#39;) are destroyed also by Weld.<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
    3. Interceptors on JavaEE components<br>
    I think this interceptors are created by Weld when the JavaEE<br>
    component classes are created, right? By the way, how can the<br>
    container make sure to destroy the interceptors?<br>
</blockquote>
    This depends on how the component classes are managed. Assuming the<br>
    components are managed using Weld-provided InjectionTarget then it<br>
    is up to the integrator to decide whether it provides interception<br>
    support or whether it should be provided by Weld. This can be<br>
    configured for each InjectionTarget individually using this builder:<br>
    <a href="http://docs.jboss.org/weld/javadoc/2.2/weld-spi/org/jboss/weld/manager/api/WeldInjectionTargetBuilder.html" target="_blank">http://docs.jboss.org/weld/javadoc/2.2/weld-spi/org/jboss/weld/manager/api/WeldInjectionTargetBuilder.html</a><br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<br>
<br>
    --<br>
    Thanks<br>
    Emily<br>
    =================<br>
    Emily Jiang<br></div></div>
    <a href="mailto:ejiang@apache.org" target="_blank">ejiang@apache.org</a> &lt;mailto:<a href="mailto:ejiang@apache.org" target="_blank">ejiang@apache.org</a>&gt;<br>
<br>
<br>
    _______________________________________________<br>
    weld-dev mailing list<br>
    <a href="mailto:weld-dev@lists.jboss.org" target="_blank">weld-dev@lists.jboss.org</a>  &lt;mailto:<a href="mailto:weld-dev@lists.jboss.org" target="_blank">weld-dev@lists.jboss.org</a>&gt;<br>
    <a href="https://lists.jboss.org/mailman/listinfo/weld-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/weld-dev</a><br>
</blockquote><span class="">
<br>
<br>
<br>
<br>
--<br>
Thanks<br>
Emily<br>
=================<br>
Emily Jiang<br>
</span><a href="mailto:ejiang@apache.org" target="_blank">ejiang@apache.org</a> &lt;mailto:<a href="mailto:ejiang@apache.org" target="_blank">ejiang@apache.org</a>&gt;<span class=""><br>
<br>
<br>
_______________________________________________<br>
weld-dev mailing list<br>
<a href="mailto:weld-dev@lists.jboss.org" target="_blank">weld-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/weld-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/weld-dev</a><br>
<br>
</span></blockquote>
<br>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Thanks<br>Emily<br>=================<br>Emily Jiang<br><a href="mailto:ejiang@apache.org" target="_blank">ejiang@apache.org</a><br></div>
</div>