I have a Dropwizard/AngularJS website. I have my assets served from an AssetsBundle on the root directory:
public void initialize(Bootstrap<WebsiteConfiguration> bootstrap) {
bootstrap.addBundle(new AssetsBundle("/assets/", "/", "index.html"));
...
}
And I want to serve my REST endpoints on /services:
public void run(WebsiteConfiguration configuration, Environment environment) throws Exception {
environment.jersey().setUrlPattern("/service");
...
}
Based on documentation and answers I've seen elsewhere, this seems like it should work. However, I just tried it, and everything on /service is returning a 404. When I dug into the app through a debugger, it appears that it's because the requests are going through the AssetServlet, not through Jersey.
Am I missing something? Is there a good way to serve my front-end on the root directory and the REST services on a sub-path?
I also struggled with this issue some time ago. What helped me was adding these lines to the app.yml
config file:
server:
type: simple
rootPath: '/rest/*'
applicationContextPath: /