Turn out, that caching on the client side does not play well when new data is loaded into the system.
28 lines
935 B
Java
28 lines
935 B
Java
package org.lucares.pdbui;
|
|
|
|
import java.nio.file.Paths;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
@Configuration
|
|
public class WebConfiguration implements WebMvcConfigurer, HardcodedValues, PropertyKeys {
|
|
|
|
private final String outputDir;
|
|
|
|
public WebConfiguration(@Value("${" + PATH_GENERATED_IMAGES + "}") final String outputDir) {
|
|
this.outputDir = outputDir;
|
|
}
|
|
|
|
@Override
|
|
public void addResourceHandlers(final ResourceHandlerRegistry registry) {
|
|
|
|
final String pathPattern = "/" + WEB_IMAGE_OUTPUT_PATH + "/**";
|
|
final String resourceLocation = "file:" + Paths.get(outputDir).toAbsolutePath() + "/";
|
|
|
|
registry.addResourceHandler(pathPattern).addResourceLocations(resourceLocation);
|
|
}
|
|
}
|