cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Obtaining DataContext in ZK
Date Mon, 21 May 2007 07:29:10 GMT
Hi Steve,

 From quick glance at the referenced document it is not clear how  
exactly thread inheritance is done in ZK, still acting on my TODO  
seems like a good idea in general. I'd appreciate a Jira on that. We  
can add it to 3.0.

Thanks
Andrus


On May 21, 2007, at 7:23 AM, Steve Wells wrote:

> Hi,
>
> I've been playing with the ZK (www.zkoss.org) framework for  
> building AJAX
> apps, and so far have found it rather impressive and easy to use.
>
> Having hit my first roadblock now is getting DataContext, as each  
> ZK request
> runs in a separate thread (see:
> http://www.zkoss.org/smalltalks/zkacegi/zkacegi.dsp
> ) I think this is the problem why I can't get DC
> with WebApplicationContextFilter and  
> DataContext.getThreadDataContext ().  I
> get  "IllegalStateException: Current thread has no bound DataContext."
>
> Looking into src for DataContext I see this comment // TODO: Andrus,
> 11/7/2005 - should we use InheritableThreadLocal instead?
>
> So I subclassed DataContext and overrode the :
> ThreadLocal threadDataContext
>
> to be
>
> InheritableThreadLocal threadDataContext
>
> changed WebApplicationContextFilter to call my subclassed  
> DataContext and
> bingo it works.
>
> Not sure if anyone else has run into this kind of thing before?  I  
> would
> raise a JIRA issue but I'm not yet confident that this is the 100%  
> correct
> solution.
>
> Steve


Mime
View raw message