When you mentioned overriding renderHead it triggered a memory of a change to the API from Wicket <= 6 to Wicket >=7:

"org.apache.wicket.Component#renderHead(HtmlHeaderContainer) is renamed to Component#internalRenderHead(HtmlHeaderContainer) WICKET-4964 Component#renderHead(HtmlHeaderContainer) was very similar to the usually used Component#renderHead(IHeaderResponse). So it has been renamed to avoid any confusions."

I'm not sure if it's related to your issue but if you were previously overriding the renderHead that takes a HtmlHeaderContainer as a parameter then it needs to be renamed to work as it did in Wicket 6.x (although the Wicket 7+ docs recommend not to override that method).

Regards,
Chrisco



On 6/06/2024 11:28 pm, Kyle Bibby wrote:
Hello,

I have a large project that I am upgrading from Wicket 6 to Wicket 8. Yes,
it's fairly old. As I am working through the various changes one issue has
stumped me.
With Wicket 8, my javascript/CSS resources that are added to my
WicketApplication are no longer being automatically added to my wicket
pages.

In my project there are helper classes where a number of resources are
defined. Examples of these helper classes are as follows:

public class JS {

public static final JavaScriptResourceReference JQUERY_UI = jquery(
JS.class, "jquery-ui.min.js" );

public static final JavaScriptResourceReference D3 = new
JavaScriptResourceReference( JS.class, "d3.min.js" );


public static void initChartJSBundle( Application wicketApp ) {

            return wicketApp.getResourceBundles().addJavaScriptBundle(
JS.class, "chart.js", JQUERY_UI, D3);

            }
}

public class CSS {

public static final CssResourceReference ICONS = css( "icons/icons.css" );

public static void initCSSResources( WebApplication wicketApp ) {

            wicketApp.mountResource( "css/icons.css", CSS.ICONS );

            }
}

Normally, widely used resources are added to my Wicket Application by
making calls to these helper classes in the init():

public abstract class MyApplication extends WebApplication {

public MyApplication() { }


@Override

public void init() {

JS.initChartJSBundle( this );

CSS.initCSSResources( this );

  }

}

I'm aware that resources are typically added to pages/components by
overriding the renderHead() method. I am in fact doing this for resources
that are specific to particular pages. However, for widely used resources,
the above example is all that was required for my Wicket 6 project to make
resources available and automatically included as headers on my Wicket
Pages. This does not seem to be the case with Wicket 8 as my resources are
not being included on any rendered pages. I have scoured the changelogs for
Wicket 8 and haven't found anything referring to the changes with resource
management.
Is there something I'm missing? Is the Wicket 6 behaviour something that
was removed over a preferred method for resource management? If so, what is
this method?

Thanks,
--
Regards,

Chris Colman
*Feezily*,
A product of /Step Ahead/ *Software* Pty Ltd
Web: feezily.com.au <http://feezily.com.au> Em: chr...@stepahead.com.au Ph: 02 9656 1278

Reply via email to