Skip to content

Commit

Permalink
PLTF-1110: explicit static path
Browse files Browse the repository at this point in the history
  • Loading branch information
ilvar committed Feb 16, 2024
1 parent 53a6553 commit 48ffb76
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public class StaticController {
@Value("classpath:static/manifest.json")
private Resource manifestFile;

@Value("#{environment.STATIC_PATH}")
private String staticPath;

private final AtomicReference<String> renderedIndexFile = new AtomicReference<>();
private final AtomicReference<String> renderedManifestFile = new AtomicReference<>();

Expand All @@ -39,7 +42,11 @@ public Mono<ResponseEntity<String>> getManifest(ServerWebExchange exchange) {
public String getRenderedFile(ServerWebExchange exchange, AtomicReference<String> renderedFile, Resource file) {
String rendered = renderedFile.get();
if (rendered == null) {
rendered = buildFile(file, exchange.getRequest().getPath().contextPath().value());
String contextPath = staticPath;
if (contextPath == null) {
contextPath = exchange.getRequest().getPath().contextPath().value();
}
rendered = buildFile(file, contextPath);
if (renderedFile.compareAndSet(null, rendered)) {
return rendered;
} else {
Expand Down

0 comments on commit 48ffb76

Please sign in to comment.