[weld-dev] CDI EJB Intergration on Weld

Emily Jiang emijiang6 at googlemail.com
Fri May 8 06:29:30 EDT 2015


Thank you Jozef for your helpful response! I have another clarification on
the interceptors on JavaEE component classes.

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?

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.

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?
Thanks
Emily

On Thu, May 7, 2015 at 8:22 AM, Jozef Hartinger <jharting at redhat.com> wrote:

>  Hi Emily, comments inline.
>
> On 05/06/2015 05:38 PM, Emily Jiang wrote:
>
>   I have a few questions on ejb integration on Weld.
>
>  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.
>
> Correct. Weld creates EJB instances using InjectionTarget.produce()
>
>
>  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?
>
> 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.
>
>
>  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?
>
> 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()
>
>
>  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?
>
> 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.
>
>
>
> --
> Thanks
> Emily
> =================
> Emily Jiang
> ejiang at apache.org
>
>
> _______________________________________________
> weld-dev mailing listweld-dev at lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/weld-dev
>
>
>


-- 
Thanks
Emily
=================
Emily Jiang
ejiang at apache.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20150508/a7594e53/attachment.html 


More information about the weld-dev mailing list