I guess just checking on the actual contribution should be enough...
I'll fix it tommorrow.
Eelco
On 9/6/05, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> Good catch, you're right! I guess using a thread local is quite a
> hack. Anyone a better idea how we should do this?
>
> Eelco
>
> On 9/6/05, Arto Arffman <[EMAIL PROTECTED]> wrote:
> > Hi,
> > I was browsing through ajax implementation (to learn Wicket and ajax), and
> > found out something odd. It seems that it is not possible to have two
> > different AjaxHandlers on the same page. AjaxHandler base class uses static
> > ThreadLocal to prevent including javascript resources more than once. If one
> > would like to use dojo and scriptaculous on the sama page, then only the
> > first one would get its script reference rendered (because they both extend
> > AjaxHandler).
> >
> > private static final ThreadLocal headContribHolder = new ThreadLocal();
> > ...
> > public final void renderHead(HtmlHeaderContainer container)
> > {
> > if (headContribHolder.get() == null)
> > {
> > headContribHolder.set(dummy);
> > renderHeadInitContribution(container);
> > }
> > renderHeadContribution(container);
> > }
> >
> >
> > I did not test this, though. I'm not fluent with Wicket and ajax, so I found
> > it too time consuming. But I did a simple code fragment that I think proves
> > my case:
> >
> > public class B {
> > public static void main(String[] args) {
> > System.out.println("start");
> > X x = new X();
> > Y y = new Y();
> > x.start();
> > System.out.println(y.isRunning());
> > y.end();
> > System.out.println(x.isRunning());
> > }
> > }
> > class BaseTL {
> > private static final ThreadLocal flag = new ThreadLocal();
> > public void start() {
> > flag.set(new Object());
> > }
> > public void end() {
> > flag.set(null);
> > }
> >
> > public boolean isRunning() {
> > return flag.get() != null;
> > }
> >
> > }
> > class X extends BaseTL {
> > }
> > class Y extends BaseTL {
> > }
> >
> > When only x is started y.isRunning() returns also true.
> >
> > Anyway, I think that the framework should provide a way to do "things" only
> > once per request cycle. Using ThreadLocal seems a little bit like a hack to
> > me.
> >
> > /Arto
> >
>
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop