@@ -30,23 +30,29 @@ public SwaggerResourceResolver(SwaggerUiConfigProperties swaggerUiConfigProperti
3030
3131 @ Override
3232 public Mono <Resource > resolveResource (ServerWebExchange exchange , String requestPath , List <? extends Resource > locations , ResourceResolverChain chain ) {
33- Mono <Resource > resolved = chain .resolveResource (exchange , requestPath , locations );
34- if (!Mono .empty ().equals (resolved )) {
35- String webJarResourcePath = findWebJarResourcePath (requestPath );
36- if (webJarResourcePath != null )
37- return chain .resolveResource (exchange , webJarResourcePath , locations );
38- }
39- return resolved ;
33+ return chain .resolveResource (exchange , requestPath , locations )
34+ .switchIfEmpty (Mono .defer (() -> {
35+ String webJarsResourcePath = findWebJarResourcePath (requestPath );
36+ if (webJarsResourcePath != null ) {
37+ return chain .resolveResource (exchange , webJarsResourcePath , locations );
38+ }
39+ else {
40+ return Mono .empty ();
41+ }
42+ }));
4043 }
4144
4245 @ Override
43- public Mono <String > resolveUrlPath (String resourcePath , List <? extends Resource > locations , ResourceResolverChain chain ) {
44- Mono <String > path = chain .resolveUrlPath (resourcePath , locations );
45- if (!Mono .empty ().equals (path )) {
46- String webJarResourcePath = findWebJarResourcePath (resourcePath );
47- if (webJarResourcePath != null )
48- return chain .resolveUrlPath (webJarResourcePath , locations );
49- }
50- return path ;
46+ public Mono <String > resolveUrlPath (String resourceUrlPath , List <? extends Resource > locations , ResourceResolverChain chain ) {
47+ return chain .resolveUrlPath (resourceUrlPath , locations )
48+ .switchIfEmpty (Mono .defer (() -> {
49+ String webJarResourcePath = findWebJarResourcePath (resourceUrlPath );
50+ if (webJarResourcePath != null ) {
51+ return chain .resolveUrlPath (webJarResourcePath , locations );
52+ }
53+ else {
54+ return Mono .empty ();
55+ }
56+ }));
5157 }
5258}
0 commit comments