On Wed, Sep 8, 2021 at 12:04 PM Arunachalam Sibisakkaravarthi < arunacha...@mcruncher.com> wrote:
> Thanks guys for your feedback > Implementing custom IHeaderResponseDecorator for css resources works for > me. > Then I noticed that both css and js resources are loaded in the header. Is > that expected behaviour in Wicket 9.x? because in my previous > implementation in Wicket 7.x JS loaded in the footer which is expected. > How do I make the JS to be loaded in the footer to improve page loading > performance? > @Martin Grigorov somehow adding css resources into > getHeaderContributorListeners > doesn't work in my case. > > You should wrap your CssHeaderItems into FilteredHeaderItem if you want them to be caught by JavaScriptFilteredIntoFooterHeaderResponse. But I wonder how this worked for you in 7.x. JavaScriptFilteredIntoFooterHeaderResponse is about JavaScriptHeaderItems, not CssHeaderItems. > > > *Thanks And RegardsSibi.ArunachalammCruncher* > > > On Wed, Sep 8, 2021 at 2:24 PM Martin Grigorov <mgrigo...@apache.org> > wrote: > > > Hi, > > > > Instead of dealing with response decorators you could > > use org.apache.wicket.markup.html.IHeaderContributor > > > > getHeaderContributorListeners().add( return response -> { > > response.render(CssHeaderItem.forReference(css1)); > > response.render(CssHeaderItem.forReference(css2)); > > }) > > > > IHeaderResponseDecorator is more powerful. It should be used when you > want > > to intercept all header contributions and add/modify/remove > contributions. > > > > On Wed, Sep 8, 2021 at 6:47 AM Arunachalam Sibisakkaravarthi < > > arunacha...@mcruncher.com> wrote: > > > > > Hi guys, > > > I am doing Wicket migration from 7.x to 9.x > > > In Wicket7.x I add css resource as below, it was working > > > > > > getHeaderResponseDecorators().add(getHeaderResponseDecorator()); > > > > > > private IHeaderResponseDecorator getHeaderResponseDecorator() > > > { > > > return response -> { > > > response.render(CssHeaderItem.forReference(css1)); > > > > > > response.render(CssHeaderItem.forReference(css2)); > > > > > > return new JavaScriptFilteredIntoFooterHeaderResponse(response, > > "scripts"); > > > }; > > > > > > whereas the above one doesn't work in Wicket9.x > > > Is there any alternative to css and js in init() method of > > WebApplication? > > > so that css/js will be available to all components. > > > > > > > > > > > > *Thanks And RegardsSibi.ArunachalammCruncher* > > > > > >