我正在使用服务于Angular 2应用程序的dropwizard AssetsBundle . 现在,angular 2 app路径具有以下模式:http://host.com/base/route,其中http://host.com/base必须重新路由到http://host.com/base/index.html,而"route"部分由Angular客户端代码解析和处理 .
遗憾的是,AssetsBundle无法通过http://host.com/base/route路径找到任何资源,并返回404错误而不是将请求重新路由到http://host.com/base/index.html .
知道如何处理这个吗?我可以编写自己的AssetsBundle来处理这种情况,但是如果有任何解决方法,我希望避免使用它 .
谢谢 .
1 回答
从Dropwizard usergroup的讨论中,可以使用IndexPageBundle插件来实现此目的:
Usergoup线程:https://groups.google.com/forum/#!topic/dropwizard-user/a8Gikq_0wcg
代码示例:https://gitlab.com/linagora/petals-cockpit/blob/master/cockpit/src/main/java/org/ow2/petals/cockpit/PetalsCockpitApplication.java