[seam-dev] What's the purpose of the method context?
Gavin King
gavin at hibernate.org
Mon Jun 9 17:40:56 EDT 2008
This is correct, it prevents some very wrong behavior when the
component is invoked recursively.
On 6/9/08, Norman Richards <orb at nostacktrace.com> wrote:
> I'm looking at a support issue, and I've found a problem with
> MethodContextInterceptor. The interceptor puts the calling component, by
> name, in the method context so that future calls to getInstance() will find
> that version of the component. However, it sets the raw, unproxied object
> so that calls to that object will not go through the interceptor chain.
> (so, an annotation like @CreateProcess won't be triggered). This seems
> wrong to me, but since I don't understand the purpose of
> MethodContextInterceptor, I can't say for sure.
>
> In case the description above isn't clear, consider a simple component like
> this:
>
> ...
> @Name("foo")
> public class Foo {
> @RaiseEvent("myEvent")
> public void actionOne() { }
>
> @CreateProcess(...)
> @Observe("myEvent")
> public void actionTwo() { }
> }
>
>
> When #{foo.one} is invoked, the unproxied Foo instance is put in the method
> context under "foo". When the event is raised, Events tries to lookup "foo"
> but instead of finding the correct instance in it's normal context, it finds
> the raw instance in the method context. actionTwo() is called, but there
> are no proxies involved and thus @CreateProcess isn't triggered.
>
> So, what in the world is the MethodContextInterceptor doing there? Should
> it really be storing the unproxied instance there?
>
>
>
>
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/seam-dev
>
--
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org
More information about the seam-dev
mailing list