On ##wicket we came to a conclusion that we need to unify and simplify 
the way duplicated header contributions are filtered. We want to make it 
as simple as possible, but yet powerful enough to be able to handle 
non-trivial usecases.

The current draft looks like this:

public class HeaderContribution
{
        static public void renderJavascriptReference(PackageResourceReference 
reference, Response response);
        
        static public void renderCSSReference(PackageResourceReference 
reference, Response response);

        static public void renderString(String string, Response response);

        static public void markRendered(Object object);

        static public boolean wasRendered(Object object);

        static public void detach();
}

The usage should be like this:

class MyBehavior extends AbstractBehavior

      private static PackageResourceReference myJavascript = ...;

      private static PackageResourceReference myCSS = ...;

      protected void renderHead(Response resp) {
         HeaderContribution.renderJavascriptReference(myJavascript, 
response);
         HeaderContribution.rednerCSSReference(myCss, response);
      }

      ...
}

Where HeaderContribution would take care of filtering duplicate 
contributions (using a Threadlocal containing a set of already 
contributed objects).

Thoughs?

-Matej

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to