Frage

Im migrating a wicket 1.4 application which has alot of js,css en images under the webapp context directory :

src/main/webapp
+js
++plugin1.js
++plugin2.js
+app
+css

e.t.c.

In our application we have used JavaScript.getHeaderContribution("js/plugin1.js");

The new wicket 6 implementation doesn't have this header contribution method.In stead you should use :

JavaHeaderItem.forReference(new JavaScriptResourceReference(Application.class,"js/plugin1.js");

But i dont want to use a scope! it will now search for files in the same package as the Application class. ContextRelativeReference is not valid in this location because it does not extend ResourceReference.

Any ideas about how i should access my webapp files without having to add every single file as a shared resource and reference it in my header contributor?

War es hilfreich?

Lösung

I have found the solution. It was easier then i expected.

You can simply use JavaScriptHeaderItem.forUrl("js/plugin1.js");

No reference and thus no scope needed.

Regards Niels

Andere Tipps

And what about mounted resource caching ?? Because when using this method nothing will be cached by browser!

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top