On May 25, 2010, at 2:38 AM, Carsten Ziegeler <[email protected]> wrote:

Justin Edelson  wrote

 Is there a
reason why request.getResourceResolver().adaptTo(Session.class)
*shouldn't* return the requested session?
Good question :) Actually I'm not sure whether this is a good idea or
not. I'm rarely using directly the JCR API - except for modifications
the Sling API is sufficient.

Yeah, but modifications are important :) The session is also needed for some access control operations.

Now, we could add some kind of a flag inside the resource resolver
implementation which returns the "correct" session on adaptTo. It would
be great if we could make this as simple as possible :)
So the question is when to set this flag - one easy solution would be to
set it if resolve(Request, String) is called. This should work in the
known cases and avoids additional interfaces and/or thread locals.
I like this. I'm traveling today, so I won't be able to prototype/test this today. But it is promising. Especially since I realized my ThreadLocal idea wouldn't work anyway.

Justin

Regards
Carsten
--
Carsten Ziegeler
[email protected]

Reply via email to