Skip to content

Commit a63cf06

Browse files
committed
Update Javadoc snippets for static resource locations
Switch to FileUrlResource, the same as what is used get with the "file:" prefix in webmvc and webflux config. See gh-33712
1 parent 789d7ef commit a63cf06

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

Diff for: framework-docs/modules/ROOT/pages/web/webflux-functional.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -835,15 +835,15 @@ Java::
835835
+
836836
[source,java,indent=0,subs="verbatim,quotes"]
837837
----
838-
Resource location = new FileSystemResource("public-resources/");
838+
Resource location = new FileUrlResource("public-resources/");
839839
RouterFunction<ServerResponse> resources = RouterFunctions.resources("/resources/**", location);
840840
----
841841
842842
Kotlin::
843843
+
844844
[source,kotlin,indent=0,subs="verbatim,quotes"]
845845
----
846-
val location = FileSystemResource("public-resources/")
846+
val location = FileUrlResource("public-resources/")
847847
val resources = router { resources("/resources/**", location) }
848848
----
849849
======

Diff for: framework-docs/modules/ROOT/pages/web/webmvc-functional.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -813,15 +813,15 @@ Java::
813813
+
814814
[source,java,indent=0,subs="verbatim,quotes"]
815815
----
816-
Resource location = new FileSystemResource("public-resources/");
816+
Resource location = new FileUrlResource("public-resources/");
817817
RouterFunction<ServerResponse> resources = RouterFunctions.resources("/resources/**", location);
818818
----
819819
820820
Kotlin::
821821
+
822822
[source,kotlin,indent=0,subs="verbatim,quotes"]
823823
----
824-
val location = FileSystemResource("public-resources/")
824+
val location = FileUrlResource("public-resources/")
825825
val resources = router { resources("/resources/**", location) }
826826
----
827827
======

Diff for: spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RouterFunctions.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public static RouterFunction<ServerResponse> resource(RequestPredicate predicate
184184
* Route requests that match the given pattern to resources relative to the given root location.
185185
* For instance
186186
* <pre class="code">
187-
* Resource location = new FileSystemResource("public-resources/");
187+
* Resource location = new FileUrlResource("public-resources/");
188188
* RouterFunction&lt;ServerResponse&gt; resources = RouterFunctions.resources("/resources/**", location);
189189
* </pre>
190190
* @param pattern the pattern to match
@@ -201,7 +201,7 @@ public static RouterFunction<ServerResponse> resources(String pattern, Resource
201201
* Route requests that match the given pattern to resources relative to the given root location.
202202
* For instance
203203
* <pre class="code">
204-
* Resource location = new FileSystemResource("public-resources/");
204+
* Resource location = new FileUrlResource("public-resources/");
205205
* RouterFunction&lt;ServerResponse&gt; resources = RouterFunctions.resources("/resources/**", location);
206206
* </pre>
207207
* @param pattern the pattern to match
@@ -224,7 +224,7 @@ public static RouterFunction<ServerResponse> resources(String pattern, Resource
224224
* <pre class="code">
225225
* Mono&lt;Resource&gt; defaultResource = Mono.just(new ClassPathResource("index.html"));
226226
* Function&lt;ServerRequest, Mono&lt;Resource&gt;&gt; lookupFunction =
227-
* RouterFunctions.resourceLookupFunction("/resources/**", new FileSystemResource("public-resources/"))
227+
* RouterFunctions.resourceLookupFunction("/resources/**", new FileUrlResource("public-resources/"))
228228
* .andThen(resourceMono -&gt; resourceMono.switchIfEmpty(defaultResource));
229229
* RouterFunction&lt;ServerResponse&gt; resources = RouterFunctions.resources(lookupFunction);
230230
* </pre>
@@ -761,7 +761,7 @@ public interface Builder {
761761
* Route requests that match the given pattern to resources relative to the given root location.
762762
* For instance
763763
* <pre class="code">
764-
* Resource location = new FileSystemResource("public-resources/");
764+
* Resource location = new FileUrlResource("public-resources/");
765765
* RouterFunction&lt;ServerResponse&gt; resources = RouterFunctions.resources("/resources/**", location);
766766
* </pre>
767767
* @param pattern the pattern to match
@@ -775,7 +775,7 @@ public interface Builder {
775775
* Route requests that match the given pattern to resources relative to the given root location.
776776
* For instance
777777
* <pre class="code">
778-
* Resource location = new FileSystemResource("public-resources/");
778+
* Resource location = new FileUrlResource("public-resources/");
779779
* RouterFunction&lt;ServerResponse&gt; resources = RouterFunctions.resources("/resources/**", location);
780780
* </pre>
781781
* @param pattern the pattern to match

Diff for: spring-webmvc/src/main/java/org/springframework/web/servlet/function/RouterFunctions.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public static RouterFunction<ServerResponse> resource(RequestPredicate predicate
168168
* Route requests that match the given pattern to resources relative to the given root location.
169169
* For instance
170170
* <pre class="code">
171-
* Resource location = new FileSystemResource("public-resources/");
171+
* Resource location = new FileUrlResource("public-resources/");
172172
* RouterFunction&lt;ServerResponse&gt; resources = RouterFunctions.resources("/resources/**", location);
173173
* </pre>
174174
* @param pattern the pattern to match
@@ -185,7 +185,7 @@ public static RouterFunction<ServerResponse> resources(String pattern, Resource
185185
* Route requests that match the given pattern to resources relative to the given root location.
186186
* For instance
187187
* <pre class="code">
188-
* Resource location = new FileSystemResource("public-resources/");
188+
* Resource location = new FileUrlResource("public-resources/");
189189
* RouterFunction&lt;ServerResponse&gt; resources = RouterFunctions.resources("/resources/**", location);
190190
* </pre>
191191
* @param pattern the pattern to match
@@ -209,7 +209,7 @@ public static RouterFunction<ServerResponse> resources(String pattern, Resource
209209
* <pre class="code">
210210
* Optional&lt;Resource&gt; defaultResource = Optional.of(new ClassPathResource("index.html"));
211211
* Function&lt;ServerRequest, Optional&lt;Resource&gt;&gt; lookupFunction =
212-
* RouterFunctions.resourceLookupFunction("/resources/**", new FileSystemResource("public-resources/"))
212+
* RouterFunctions.resourceLookupFunction("/resources/**", new FileUrlResource("public-resources/"))
213213
* .andThen(resource -&gt; resource.or(() -&gt; defaultResource));
214214
* RouterFunction&lt;ServerResponse&gt; resources = RouterFunctions.resources(lookupFunction);
215215
* </pre>
@@ -674,7 +674,7 @@ public interface Builder {
674674
* Route requests that match the given pattern to resources relative to the given root location.
675675
* For instance
676676
* <pre class="code">
677-
* Resource location = new FileSystemResource("public-resources/");
677+
* Resource location = new FileUrlResource("public-resources/");
678678
* RouterFunction&lt;ServerResponse&gt; resources = RouterFunctions.resources("/resources/**", location);
679679
* </pre>
680680
* @param pattern the pattern to match
@@ -688,7 +688,7 @@ public interface Builder {
688688
* Route requests that match the given pattern to resources relative to the given root location.
689689
* For instance
690690
* <pre class="code">
691-
* Resource location = new FileSystemResource("public-resources/");
691+
* Resource location = new FileUrlResource("public-resources/");
692692
* RouterFunction&lt;ServerResponse&gt; resources = RouterFunctions.resources("/resources/**", location);
693693
* </pre>
694694
* @param pattern the pattern to match

0 commit comments

Comments
 (0)