Apache Wicket - externalizing components

As our Apache Wicket 6 application is growing and growing, we are thinking about externalizing components to some kind of UI microservice. Therefore we would like to build a Wicket application that can deliver the following content as JSON (or XML):



{
"js":
[
"/external-component/question/general.js",
"/external-component/question/input.js"
],
"style":
[
"/external-component/question/general.css",
"/external-component/question/input.css"
],
"content": "/external-component/question/input.html"
}


Calling /external-component/question/input.html would then render the component and deliver something like this:



<div>
<form>
Please ask your question:
<input type="text" />
<input type="submit" />
</form>
</div>


Of course, it's important that the first call doesn't render the component on the fly, as this may take a while (backend calls).



We tried our best, but couldn't deliver the JS scripts Wicket needs without rendering the component.



Has anybody tried something similar or has an idea how to do this?