diff --git a/framework-docs/modules/ROOT/pages/web/webflux-functional.adoc b/framework-docs/modules/ROOT/pages/web/webflux-functional.adoc index 90a2e33547..3966294c90 100644 --- a/framework-docs/modules/ROOT/pages/web/webflux-functional.adoc +++ b/framework-docs/modules/ROOT/pages/web/webflux-functional.adoc @@ -802,25 +802,25 @@ Java:: + [source,java,indent=0,subs="verbatim,quotes",role="primary"] ---- -ClassPathResource index = new ClassPathResource("static/index.html"); -List extensions = List.of("js", "css", "ico", "png", "jpg", "gif"); -RequestPredicate spaPredicate = path("/api/**").or(path("/error")).or(pathExtension(extensions::contains)).negate(); -RouterFunction redirectToIndex = route() - .resource(spaPredicate, index) - .build(); + ClassPathResource index = new ClassPathResource("static/index.html"); + List extensions = List.of("js", "css", "ico", "png", "jpg", "gif"); + RequestPredicate spaPredicate = path("/api/**").or(path("/error")).or(pathExtension(extensions::contains)).negate(); + RouterFunction redirectToIndex = route() + .resource(spaPredicate, index) + .build(); ---- Kotlin:: + [source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"] ---- -val redirectToIndex = router { - val index = ClassPathResource("static/index.html") - val extensions = listOf("js", "css", "ico", "png", "jpg", "gif") - val spaPredicate = !(path("/api/**") or path("/error") or - pathExtension(extensions::contains)) - resource(spaPredicate, index) -} + val redirectToIndex = router { + val index = ClassPathResource("static/index.html") + val extensions = listOf("js", "css", "ico", "png", "jpg", "gif") + val spaPredicate = !(path("/api/**") or path("/error") or + pathExtension(extensions::contains)) + resource(spaPredicate, index) + } ---- ====== @@ -835,16 +835,16 @@ Java:: + [source,java,indent=0,subs="verbatim,quotes",role="primary"] ---- -Resource location = new FileSystemResource("public-resources/"); -RouterFunction resources = RouterFunctions.resources("/resources/**", location); + Resource location = new FileSystemResource("public-resources/"); + RouterFunction resources = RouterFunctions.resources("/resources/**", location); ---- Kotlin:: + [source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"] ---- -val location = FileSystemResource("public-resources/") -val resources = router { resources("/resources/**", location) } + val location = FileSystemResource("public-resources/") + val resources = router { resources("/resources/**", location) } ---- ====== diff --git a/framework-docs/modules/ROOT/pages/web/webmvc-functional.adoc b/framework-docs/modules/ROOT/pages/web/webmvc-functional.adoc index bac604d4d6..23f5e7045b 100644 --- a/framework-docs/modules/ROOT/pages/web/webmvc-functional.adoc +++ b/framework-docs/modules/ROOT/pages/web/webmvc-functional.adoc @@ -780,25 +780,25 @@ Java:: + [source,java,indent=0,subs="verbatim,quotes",role="primary"] ---- -ClassPathResource index = new ClassPathResource("static/index.html"); -List extensions = List.of("js", "css", "ico", "png", "jpg", "gif"); -RequestPredicate spaPredicate = path("/api/**").or(path("/error")).or(pathExtension(extensions::contains)).negate(); -RouterFunction redirectToIndex = route() - .resource(spaPredicate, index) - .build(); + ClassPathResource index = new ClassPathResource("static/index.html"); + List extensions = List.of("js", "css", "ico", "png", "jpg", "gif"); + RequestPredicate spaPredicate = path("/api/**").or(path("/error")).or(pathExtension(extensions::contains)).negate(); + RouterFunction redirectToIndex = route() + .resource(spaPredicate, index) + .build(); ---- Kotlin:: + [source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"] ---- -val redirectToIndex = router { - val index = ClassPathResource("static/index.html") - val extensions = listOf("js", "css", "ico", "png", "jpg", "gif") - val spaPredicate = !(path("/api/**") or path("/error") or - pathExtension(extensions::contains)) - resource(spaPredicate, index) -} + val redirectToIndex = router { + val index = ClassPathResource("static/index.html") + val extensions = listOf("js", "css", "ico", "png", "jpg", "gif") + val spaPredicate = !(path("/api/**") or path("/error") or + pathExtension(extensions::contains)) + resource(spaPredicate, index) + } ---- ====== @@ -813,16 +813,16 @@ Java:: + [source,java,indent=0,subs="verbatim,quotes",role="primary"] ---- -Resource location = new FileSystemResource("public-resources/"); -RouterFunction resources = RouterFunctions.resources("/resources/**", location); + Resource location = new FileSystemResource("public-resources/"); + RouterFunction resources = RouterFunctions.resources("/resources/**", location); ---- Kotlin:: + [source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"] ---- -val location = FileSystemResource("public-resources/") -val resources = router { resources("/resources/**", location) } + val location = FileSystemResource("public-resources/") + val resources = router { resources("/resources/**", location) } ---- ======