Hi,
I'm quite new to Spark and trying to figure out how do I achieve the following behavior.
I have on my server two types of files that I want to access from the client side:
/tmp/photos
.As far as I understand from the documentation with externalStaticFileLocation()
or staticFileLocation()
I can only set one of these locations to be accessed. How can I serve these two locations together?
Tried to ask the same on stackoverflow, but no answers.
Hopefully here I'll get some more help.
Thanks :)
public synchronized void configureExternal(String folder) {
Assert.notNull(folder, "'folder' must not be null");
if (!externalStaticResourcesSet) {
try {
ExternalResource resource = new ExternalResource(folder);
if (!resource.getFile().isDirectory()) {
LOG.error("External Static resource location must be a folder");
return;
}
if (staticResourceHandlers == null) {
staticResourceHandlers = new ArrayList<>();
}
staticResourceHandlers.add(new ExternalResourceHandler(folder, "index.html"));
LOG.info("External StaticResourceHandler configured with folder = " + folder);
} catch (IOException e) {
LOG.error("Error when creating external StaticResourceHandler", e);
}
StaticFilesFolder.externalConfiguredTo(folder);
externalStaticResourcesSet = true;
}
}