Skip to main content

[javaee-spec users] Re: About Interceptors's enabling

  • From: Pete Muir <pmuir@...>
  • To: Tang Yong <tangyong@...>
  • Cc: Pete Muir <pete.muir@...>, Bill Shannon <bill.shannon@...>, Mark Struberg <struberg@...>, "users@..." <users@...>
  • Subject: [javaee-spec users] Re: About Interceptors's enabling
  • Date: Sun, 20 Oct 2013 15:52:44 -0500

Mark gives a great answer, but to expand slightly, the solution you propose 
is not possible, as there is no "application level" beans.xml descriptor, and 
adding one would be immensely confusing. We also had a requirement for 
interceptors to be auto-enabled.

Were we start from scratch, your design could be good, but unfortunately it 
doesn't meet the requirements we had.

On 19 Oct 2013, at 05:16, Tang Yong <tangyong@...> wrote:

> Peter,
> 
> My real question is that : " Is the fact that using @Priority automatically 
> enables interceptors *reasonable*? "
> 
> I think that the spec should not let @Priority automatically enables 
> interceptors, either enabling interceptors in beans.xml explicitly or by 
> other annotation, eg. "@Interceptor". Instead, @Priority is only used for 
> defining order of interceptors.
> 
> Thanks
> Tang
> 
> Bill Shannon wrote:
>>  I agree, it sounds like an implementation bug.  Please file a bug against 
>> GlassFish <https://java.net/jira/browse/GLASSFISH>.
>> Mark Struberg wrote on 10/18/13 09:13:
>>> I'd say that's an impl bug.
>>> 
>>> beans.xml and @Priority only say IF and in which order the interceptor is 
>>> enabled. But it still is there only once.
>>> 
>>> LieGrue,
>>> strub
>>> 
>>> 
>>>    
>>> ------------------------------------------------------------------------
>>>    *From:* John D. Ament <john.d.ament@...>
>>>    *To:* users@...
>>>    *Cc:* Tang Yong <tangyong@...>; Pete Muir
>>>    <pete.muir@...>; Bill Shannon <bill.shannon@...>
>>>    *Sent:* Thursday, 17 October 2013, 15:24
>>>    *Subject:* [javaee-spec users] Re: About Interceptors's enabling
>>> 
>>>    I wonder if this is somehow related to an issue I saw pop up on SO
>>>    recently.
>>> 
>>>    Basically, there's an issue where if an interceptor is annotated
>>>    @Priority and listed in beans.xml, it gets invoked twice.
>>> 
>>>    Is this the expected behavior?
>>> 
>>>    John
>>> 
>>>    On Thu, Oct 17, 2013 at 9:12 AM, Pete Muir
>>>    <pmuir@... <mailto:pmuir@...>> wrote:
>>>    > Hi Tang,
>>>    >
>>>    > I'm afraid I don't quite understand your question :-(
>>>    >
>>>    > Perhaps you could provide a concrete example of what you would
>>>    prefer?
>>>    >
>>>    > Pete
>>>    >
>>>    > On 17 Oct 2013, at 09:03, Tang Yong <tangyong@...
>>>    <mailto:tangyong@...>> wrote:
>>>    >
>>>    >> Pete
>>>    >> CC: Bill
>>>    >>
>>>    >> I have a question about Interceptors's enabling.
>>>    >>
>>>    >> The story should come from [1] and [2], and from "5.3 Ordering
>>>    >> Interceptors using the Priority Annotation" of JSR 318.
>>>    >>
>>>    >> "An interceptor bound to a component, a component method, or
>>>    constructor
>>>    >> using interceptor binding may be enabled for the entire
>>>    application by
>>>    >> applying the Priority annotation, along with a priority value,
>>>    on the
>>>    >> interceptor class."
>>>    >>
>>>    >> From another fact, Interceptors are deployment-specific and are
>>>    disabled
>>>    >> by default. Like alternatives, interceptors have to be
>>>    >> enabled by using the CDI deployment descriptor beans.xml of the
>>>    jar.
>>>    >>
>>>    >> Well, if I uses interceptors binding, I will meet two cases,
>>>    >>
>>>    >> 1) I must enable interceptors in beans.xml explicitly if I am
>>>    not ready
>>>    >> to use @Priority.
>>>    >>
>>>    >> 2) Once I uses @Priority, I need to take care of whether to need to
>>>    >> declare interceptors in beans.xml becase this may break/override
>>>    >> invocation order of interceptors.
>>>    >>
>>>    >> Based on such facts, enable interceptors in beans.xml
>>>    explicitly has
>>>    >> brought two different resposibilities for interceptors binding,
>>>    so, for
>>>    >> an user, this has caused some puzzles just as I made a mistake
>>>    in [2].
>>>    >>
>>>    >> My question is that why we can not make "enable interceptors in
>>>    >> beans.xml explicitly" bring *only one* resposibility?
>>>    >>
>>>    >> Thanks
>>>    >> Tang
>>>    >>
>>>    >> [1]:
>>>    >>
>>>    
>>> https://java.net/projects/javaee-spec/lists/jsr342-experts/archive/2012-12/message/15
>>>    >> [2]: https://issues.jboss.org/browse/WELD-1528
>>>    >>
>>>    >>
>>>    >> --
>>>    >> ----------------------
>>>    >> Tang Yong
>>>    >> Senior Engineer
>>>    >> GlassFish Committer (OSGi & OSGi-JavaEE)
>>>    >> OSGi Alliance Supporter
>>>    >> Blog: http://osgizone.typepad.com/tangyong/
>>>    >>
>>>    >> Nanjing Fujitsu NanDa Software Tec CO.,LTD
>>>    >> http://www.fujitsu.com/cn/fnst
>>>    >> Tel: +86-25-86630566-8310
>>>    >> Fax: +86-25-83317685
>>>    >> ----------------------
>>>    >>
>>>    >
>>> 
>>> 
> 
> -- 
> ----------------------
> Tang Yong
> Senior Engineer
> GlassFish Committer (OSGi & OSGi-JavaEE)
> OSGi Alliance Supporter
> Blog: http://osgizone.typepad.com/tangyong/
> 
> Nanjing Fujitsu NanDa Software Tec CO.,LTD
> http://www.fujitsu.com/cn/fnst
> Tel: +86-25-86630566-8310
> Fax: +86-25-83317685              
> ----------------------
> 



[javaee-spec users] About Interceptors's enabling

Tang Yong 10/17/2013

[javaee-spec users] Re: About Interceptors's enabling

Pete Muir 10/17/2013

[javaee-spec users] Re: About Interceptors's enabling

John D. Ament 10/17/2013

[javaee-spec users] Re: About Interceptors's enabling

Mark Struberg 10/18/2013

[javaee-spec users] Re: About Interceptors's enabling

Bill Shannon 10/18/2013

[javaee-spec users] Re: About Interceptors's enabling

Tang Yong 10/19/2013

[javaee-spec users] Re: About Interceptors's enabling

Mark Struberg 10/19/2013

[javaee-spec users] Re: About Interceptors's enabling

Pete Muir 10/20/2013

[javaee-spec users] Re: About Interceptors's enabling

Tang Yong 10/23/2013

[javaee-spec users] Re: About Interceptors's enabling

Pete Muir 10/23/2013

[javaee-spec users] Re: About Interceptors's enabling

Tang Yong 10/23/2013

[javaee-spec users] Re: About Interceptors's enabling

JJ Snyder 10/24/2013

[javaee-spec users] Re: About Interceptors's enabling

Jozef Hartinger 10/23/2013

[javaee-spec users] Re: About Interceptors's enabling

Mark Struberg 10/23/2013
 
 
Close
loading
Please Confirm
Close