beehive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chad Schoettger" <chad.schoett...@gmail.com>
Subject WebContextFactoryProvider not exactly working as it should...
Date Wed, 17 May 2006 23:08:00 GMT
I was verifing that the beehive webcontext bean context implementations were
being used (I modified the WebContextFactoryProvider to enable them)
and found a bug. This is pretty complicated code so I thought I'd check with
the list before submitting a fix for it.

The problem is this:

When a control bean attempts to get the service used to create it's control
bean context, the ControlBeanContext.getService() method will return null if
it does not have a parent.  So, for example, when a control bean is being
added to the ServletBeanContext, the ServletBeanContext doesn't have a
parent (since it is the top-level container) and the call fails, we end up
with a java.beans.BeanContextServicesSupport context.

It seems to be a chicken/egg problem, the control bean needs to create a
control bean context using a service from a container which it is not a
member of but cannot become a member until the context has been created.

I think a have a fix for it, I've attached a diff of ServletBeanContext
which solves the problem by overriding the ControlBeanContext.getService()
method.  It will invoke the CBC's getService() first but if that call fails
and the requested service is a BeanContextServiceProvider, it will supply
the caller with the one it has registered.

I wouldn't consider this an optimal solution, but short of a pretty large
rewrite I couldn't come up with much else.

Thoughts/comments?

 - Thanks,
    Chad

Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message