<div dir="ltr"><div>Thank you Jozef for your help with clarifying this! <br><br></div>By the way, for non-CDI interceptors, though EE7 spec lists these interceptors under the category of JavaEE component classes, I guess they are different from other other JavaEE component classes. For these interceptor instance creation, I guess we should not use injectiontarget.produce(). Am I right to say that we need to call into the correct constructor with the resolved arguments? <br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 21, 2015 at 1:25 PM, Jozef Hartinger <span dir="ltr"><<a href="mailto:jharting@redhat.com" target="_blank">jharting@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"><span class="">
On 05/13/2015 12:35 AM, Emily Jiang wrote:<br>
<blockquote type="cite">
<div dir="ltr">
<div>
<div>
<div>A further question on EJB injection, <br>
<br>
In the Weld reference doc, performing injection on JavaEE
component class:<br>
To help the integrator, Weld provides
WeldManager.fireProcessInjectionTarget() which returns the<br>
InjectionTarget to use.<br>
<br>
</div>
The statement was not mentioned when it talks about
performing injection on EJBs. My question is that do we need
to call the above method to fire the event.<br>
</div>
</div>
</div>
</blockquote></span>
No, you only need to call this for non-contextual components. For
session beans this is done by Weld automatically.<span class=""><br>
<blockquote type="cite">
<div dir="ltr">
<div>
<div><br>
Another observation with the code snippet on EJB section. It
did not mention how the instance was created. I think
'it.produce()' needs to be there before the it.inject().<br>
<br>
// Obtain the EjbDescriptor for the EJB<br>
// You may choose to use this utility method to get the
descriptor<br>
EjbDescriptor<?> ejbDescriptor =
beanManager.getEjbDescriptor(ejbName);<br>
// Get an the Bean object<br>
Bean<?> bean = beanManager.getBean(ejbDescriptor);<br>
// Create the injection target<br>
InjectionTarget it =
deploymentBeanManager.createInjectionTarget(ejbDescriptor);<br>
// Per instance required, create the creational context<br>
CreationalContext<?> cc =
deploymentBeanManager.createCreationalContext(bean);<br>
<br>
</div>
<div><b>.... missing the line... Object instance =
it.produce()</b><br>
</div>
<div>// Perform injection and call initializers<br>
it.inject(instance, cc);<br>
</div>
</div>
</div>
</blockquote></span>
Yes, looks like the line is missing.<div><div class="h5"><br>
<blockquote type="cite">
<div dir="ltr">
<div>
<div><br>
</div>
Thanks<br>
</div>
Emily<br>
<div>
<div><br>
<br>
</div>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, May 8, 2015 at 11:29 AM, Emily
Jiang <span dir="ltr"><<a href="mailto:emijiang6@googlemail.com" target="_blank">emijiang6@googlemail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>
<div>
<div>Thank you Jozef for your helpful response! I have
another clarification on the interceptors on JavaEE
component classes. <br>
<br>
EE7 spec states the JavaEE component classes, listed
in Table EE.5-1, need to support interceptors. Take
servlet for an example, which methods can be
intercepted?<br>
<br>
</div>
As the servlet classes are invoked by the container,
according to CDI1.2 spec, it seems only
service(ServletRequest, ServletResponse) can be
intercepted. No other methods can be intercepted. <br>
<br>
Normally customer applications override doPost or
doGet, but they cannot be intercepted. I cannot see
any value of support interceptors on Servlet. Anything
I missed?<br>
</div>
Thanks<span><font color="#888888"><br>
</font></span></div>
<span><font color="#888888">Emily<br>
</font></span></div>
<div>
<div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, May 7, 2015 at 8:22
AM, Jozef Hartinger <span dir="ltr"><<a href="mailto:jharting@redhat.com" target="_blank">jharting@redhat.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"> Hi Emily,
comments inline.<span><br>
<br>
<div>On 05/06/2015 05:38 PM, Emily Jiang
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>
<div>
<div>
<div>I have a few questions on ejb
integration on Weld. <br>
<br>
</div>
1)Does Weld handle the instance
creation for ejb (using
injectionTarget.produce) or delegate
the instance creation to EJB
container? I guess Weld will create
the instead as it can manage
decorators. If not, how can
decorators be managed? Please
confirm.<br>
</div>
</div>
</div>
</div>
</blockquote>
</span> Correct. Weld creates EJB instances
using InjectionTarget.produce()<span><br>
<blockquote type="cite">
<div dir="ltr">
<div>
<div>
<div><br>
</div>
2) When Weld creates the EJB instance,
how can the other non-CDI
aroundconstruct interceptors (such as
the interceptors defined via
ejb-jar.xml or @Interceptors) be
passed in? I found out the
WeldCreationContext and
AroundConstructCallback but I cannot
find anything mentioned in the weld
reference doc. Is this the right
plugin point?<br>
</div>
</div>
</div>
</blockquote>
</span> Correct, AroundConstructCallback is the
API you need to use. The JavaDoc should be
helpful. Let me know if anything is not clear.
I'll add a note about it to the refdoc.<span><br>
<blockquote type="cite">
<div dir="ltr">
<div>
<div><br>
</div>
3)If Weld creates the EJB instance, how
can all interceptors (cdi style and ejb
style) be invoked? Will the instance
need to be passed back to EJB container
together with all CDI interceptors (get
hold of them via
EjbEndpointServiceImpl.java) and EJB
container needs to manage the
interceptors being invoked?<br>
</div>
</div>
</blockquote>
</span> For interception type other than
@AroundConstruct we leave it up to the EJB
implementation to handle interception.
Information about CDI interceptors is exposed to
the EJB implementation via
EjbServices.registerInterceptors()<span><br>
<blockquote type="cite">
<div dir="ltr">
<div><br>
</div>
4)In Weld spec, it says you must register
the SessionBeanInterceptor as the inner
most interceptor in the stack for all
EJBS. Can you clarify what inner most
means? Does this interceptor need to be
the first EJB interceptor to be called or
the last EJB interceptor to be invoked?<br>
</div>
</blockquote>
</span> Not sure why it says inner most - it
should be outer most instead that is it should
be called as first so that the @RequestScope is
available for the other interceptors called
later in the chain.<br>
<blockquote type="cite"><span>
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div><br clear="all">
<div><br>
-- <br>
<div>Thanks<br>
Emily<br>
=================<br>
Emily Jiang<br>
<a href="mailto:ejiang@apache.org" target="_blank">ejiang@apache.org</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
</span>
<pre>_______________________________________________
weld-dev mailing list
<a href="mailto:weld-dev@lists.jboss.org" target="_blank">weld-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/weld-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/weld-dev</a></pre>
</blockquote>
<br>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
<div>Thanks<br>
Emily<br>
=================<br>
Emily Jiang<br>
<a href="mailto:ejiang@apache.org" target="_blank">ejiang@apache.org</a><br>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
<div>Thanks<br>
Emily<br>
=================<br>
Emily Jiang<br>
<a href="mailto:ejiang@apache.org" target="_blank">ejiang@apache.org</a><br>
</div>
</div>
</blockquote>
<br>
</div></div></div>
</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>