File tree 1 file changed +8
-0
lines changed
api/src/main/java/io/kafbat/ui/util
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 1
1
package io .kafbat .ui .util ;
2
2
3
3
import java .io .IOException ;
4
+ import lombok .extern .slf4j .Slf4j ;
4
5
import org .jetbrains .annotations .NotNull ;
5
6
import org .springframework .core .io .ClassPathResource ;
6
7
import org .springframework .core .io .buffer .DataBufferFactory ;
15
16
import org .springframework .web .server .WebFilterChain ;
16
17
import reactor .core .publisher .Mono ;
17
18
19
+ @ Slf4j
18
20
public class StaticFileWebFilter implements WebFilter {
19
21
20
22
private static final String INDEX_HTML = "/static/index.html" ;
@@ -29,6 +31,12 @@ public StaticFileWebFilter() {
29
31
public StaticFileWebFilter (String path , ClassPathResource resource ) {
30
32
this .matcher = ServerWebExchangeMatchers .pathMatchers (HttpMethod .GET , path );
31
33
34
+ if (!resource .exists ()) {
35
+ log .warn ("Resource [{}] does not exist. Frontend might not be available." , resource .getPath ());
36
+ contents = "Missing index.html. Make sure the app has been built with a correct (prod) profile." ;
37
+ return ;
38
+ }
39
+
32
40
try {
33
41
this .contents = ResourceUtil .readAsString (resource );
34
42
} catch (IOException e ) {
You can’t perform that action at this time.
0 commit comments