We're migrating an existing application to Spring Boot. The application in question (Genie) acts as a distributed, scalable client for data processing clusters like Hadoop or Presto. As such we need to output results of queries to disk and allow users access to their data. In the past we've done this by enabling directory listing in Tomcat where we would deploy our war and allowing users to browse and access their files using the DefaultServlet.
I tried exporting the directory using resource handlers like so:
@SpringBootApplication
public class GenieWeb extends WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter {
// Other configuration
@Override
public void addResourceHandlers(final ResourceHandlerRegistry registry) {
super.addResourceHandlers(registry);
final String myExternalFilePath = "file:///path/to/dir/";
registry
.addResourceHandler("/urlPath/*")
.setCachePeriod(0)
.addResourceLocations(myExternalFilePath);
}
}
This works fine when the URI of the resource is known but any request for a directory returns a 404. Ideally this would behave the same way the DefaultServlet in standalone Tomcat behaves when listings is set to true as an init parameter.
I've tried various ways to access the Tomcat configuration and the DefaultServlet in particular but have had no luck enabling directory listing via the typical "listing" property.
Excessive searching didn't turn up any results so I was curious if anyone knew if this was possible before I resign myself to going back to a WAR build or fronting with Apache. The main reason I don't want to do this is to make deploying our application as painless as possible and having everything self contained in one jar file has a lot of appeal.
Thanks in advance!