[seam-dev] Retrieving the Bean object for an interceptor

Stuart Douglas stuart at baileyroberts.com.au
Tue Apr 13 20:31:11 EDT 2010


I think that the easiest way to address this would be to allow the interceptor to inject the Bean and AnnotatedType object for the intercepted object.

 e.g. 
@Inject @InterceptedMetadata Bean bean;

@Inject @InterceptedMetadata AnnotatedType type;

In theory the AnnotatedType could be null, but in practice custom beans don't support interceptors, so this should be fine. 

This allows the interceptor to read the annotation information from the AnnotatedType. We could also allow beans to inject this information as well, but I think that this can be implemented as a portable extension without any spec changes. 


Stuart

________________________________________
From: Pete Muir [pmuir at redhat.com]
Sent: Friday, 9 April 2010 9:24 PM
To: Nicklas Karlsson
Cc: Stuart Douglas; seam-dev at lists.jboss.org
Subject: Re: [seam-dev] Retrieving the Bean object for an interceptor

No, I think you are right Stuart. Sounds like something the MR should address.

On 6 Apr 2010, at 07:38, Nicklas Karlsson wrote:

> In the Good Old Days, say late 2008, when the spec was a draft for WebBeans, it said
>
> "If any class-level interceptor binding type is specified in XML, the interceptor binding annotations appearing on the implementation
> class are ignored. The class-level interceptor bindings for the Web Bean include all interceptor bindings declared
> using XML, together with all interceptor bindings of all stereotypes declared by the Web Bean.
>
> Otherwise, if no class-level interceptor binding types are specified in XML, the interceptor binding annotations that appear
> on the implementation class are used. The class-level interceptor bindings for the Web Bean include all interceptor bindings
> declared by annotating the implementation class, together with all interceptor bindings of all stereotypes declared by
> the Web Bean.
>
> If any method-level interceptor binding type is specified in XML, the interceptor binding annotations appearing on that
> method are ignored. The method-level interceptor bindings for that method include only the interceptor bindings declared
> using XML.
>
> Otherwise, if no method-level interceptor binding types are specified in XML, the interceptor binding annotations that appear
> on that method are used. The method-level interceptor bindings for that method include all the interceptor bindings
> declared by annotating the method."
>
>
>
> On Tue, Apr 6, 2010 at 7:56 AM, Stuart Douglas <stuart at baileyroberts.com.au> wrote:
> I can't see any way to get information about the actual Bean that an interceptor is bound to.
>
> For example say I have a class:
>
> @Security("#{true}")
> class SomeClass
> {
>   ...
> }
>
> Another bean with the same class is wired up with XML:
>
> <t:SomeClass>
>  <se:Security>#{false}</se:Security>
>  ....
> </t:SomeClass>
>
> I cannot see any way for a security interceptor to know which Bean it is intercepting, and therefore figure out which annotation to use. Is there something I am missing here?
>
> Stuart
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/seam-dev
>
>
>
> --
> ---
> Nik
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/seam-dev




More information about the seam-dev mailing list