>>>>> "Chaz Kettleson via dev" <[email protected]>:
> Your example works fine, but would not work for loading static > resources. My example is a bit convoluted. Probably should have done > something like this: Ah! I don't use the framework to serve static resources. I serve them myself with this servlet: https://github.com/steinarb/sampleapp/blob/master/sampleapp.web.frontend/src/main/java/no/priv/bang/sampleapp/web/frontend/SampleappServlet.java#L31 FrontendServlet is a class that serves static files from the classpath resources of the OSGi bundle it is part of, and serves the index.html resource booting the frontend app from a list of paths. https://github.com/steinarb/servlet/blob/master/servlet/servlet.frontend/src/main/java/no/priv/bang/servlet/frontend/FrontendServlet.java#L40 What's not in the list of paths or matches a classpath resources gets 404. The list of paths is generated by from the react-router paths of the react frontend application, extracted by a vite plugin: https://steinar.bang.priv.no/2025/02/26/export-react-router-routes-for-use-in-java-servlet/
