I’m in the process of upgrading an application to Wicket 9 in order to get
strict CSP compliance.
I’m using
response.render(CssHeaderItem.forReference(new
CssResourceReference(MyClass.class, “file.css", getLocale(), "screen", "")));
to have Wicket provide the proper reference to the CSS file. This works fine,
as long as the CSS file is next to the Java/HTML source files.
But I want to keep the projects file structure with the CSS files in de
xdocs/css folder.
I’m trying to accomplish this by adding its path with
getResourceSettings().getResourceFinders().add(new
WebApplicationPath(getServletContext(), "xdocs/css"));
This does not give me an error, but loading the CSS file fail in the
constructor of CssResourceReference():
ResourceReferenceRegistry:### - A ResourceReference wont be created for
a resource with key [scope: ###; name: file.css; locale: null; style: null;
variation: null] because it cannot be located.
What am I missing here? I suppose the CssResourceReference class should be
using the ResourceFinders that have been set up?
Many thanks in advance,
Peter