Stephan Schmidt wrote:
> - Does it integrate with Jersey? Did anyone use Qi4j with Jersey?

As Peter said, Niclas is working on Restlet integration. Do you have any 
experience on Restlet vs Jersey? We are relative newbies ourselves, so 
any input would be interesting.

> - Does Qi4J integrate with WebBeans (Resin), does it support Session 
> Scopse etc. for injections?

Nope and nope.

But the scope thing is an interesting question, and I've been thinking 
about it, and here's my current conclusion.

Whether it is session, request, application or XYZ scope, there seems to 
be two cases: if X is in the A scope and Y wants an injection of X, X 
can either be in the same scope as Y, or not.

If X is in the same scope as Y, then those objects were clearly created 
in that scope, e.g. two objects created in a session or request. For 
this case I would use the @Uses injection scope, and provide the 
dependencies more or less explicitly at creation time. For example, 
let's say there's a front servlet receiving a request. Then it can 
create a graph of related objects that use each other and 
request-related stuff by doing objectbuilders/compositebuilders and the 
@Uses injection to tie them all together.

If X is not in the same scope as Y, e.g. Y is a Service that uses some 
session scoped object X then it makes no sense at all to inject X into 
Y. It's not really possible. However, in my mind the access of X by Y in 
such a case is always going to be done within a particular context, such 
as handling a request. When receiving the initial request any such 
resources (like X) can then be provided through the ContextComposite 
mechanism, i.e. as a threadlocal. The code that receives the request 
sets up all the threadlocals as ContextComposites, and then handles the 
request. Any Service that wants to use context for that request simply 
injects the ContextComposite that handles the particular scope it wants. 
This allows for any number of "scopes" to be defined.

For example, in SiteVision there was a couple of more "scopes" set up as 
threadlocals when a request was received: which site was being served, 
which page was being served, which user did the invocation, etc. all 
this was set up as threadlocals that the Services could access.

Does this make sense? If so, is there any way we can make it easier to 
set up, manage and access such ContextComposites?

/Rickard

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to