0

I'm aggregating JavaScript resources like this

getResourceBundles().addJavaScriptBundle(MyWicketApplication.class,
                "js_bundle.js",
                wicketJQuery,
                wicketAjax,
                JavascriptResources.RESOURCE_1.getReference(),
                JavascriptResources.RESOURCE_2.getReference(),
                JavascriptResources.RESOURCE_3.getReference(),
                JavascriptResources.RESOURCE_4.getReference(),
                JavascriptResources.RESOURCE_5.getReference(),
                JavascriptResources.RESOURCE_6.getReference(),
                JavascriptResources.RESOURCE_7.getReference(),
                JavascriptResources.RESOURCE_8.getReference());

What I get after a page is rendered is something like this

./wicket/resource/com.my.company.MyWicketApplication/js_bundle-ver-3CA0BF236223C36D08331F94E24FAAAE.js

I don't mind having the part

js_bundle-ver-3CA0BF236223C36D08331F94E24FAAAE.js

But how to hide / remove this part

./wicket/resource/com.my.company.MyWicketApplication

to something like this

/resources/js_bundle-ver-3CA0BF236223C36D08331F94E24FAAAE.js

1 Answer 1

0

You could use the result of getResourceBundles().addJavaScriptBundle(...) and mount it at specific path:

 JavaScriptReferenceHeaderItem jsrhi = getResourceBundles().addJavaScriptBundle(...);
 ResourceReference rr = jsrhi.getReference();
 webApplication.mountResource("some/path", rr);
1
  • 1
    Thank you. It worked, but I hade to change JavascriptReferenceHeaderItem to ResourceReference and had to change addJavaScriptBundle(...) to addJavaScriptBundle(...).reference(). I.e ResourceReference jsrhi = getResourceBundles().addJavaScriptBundle(...).reference();
    – treo
    Commented Jan 9, 2023 at 7:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.