Javadoc
Closes gh-23075
This commit is contained in:
@@ -143,10 +143,10 @@ public abstract class RouterFunctions {
|
||||
* The returned function can be {@linkplain Function#andThen(Function) composed} on, for
|
||||
* instance to return a default resource when the lookup function does not match:
|
||||
* <pre class="code">
|
||||
* Mono<Resource> defaultResource = Mono.just(new ClassPathResource("index.html"));
|
||||
* Function<ServerRequest, Mono<Resource>> lookupFunction =
|
||||
* Optional<Resource> defaultResource = Optional.of(new ClassPathResource("index.html"));
|
||||
* Function<ServerRequest, Optional<Resource>> lookupFunction =
|
||||
* RouterFunctions.resourceLookupFunction("/resources/**", new FileSystemResource("public-resources/"))
|
||||
* .andThen(resourceMono -> resourceMono.switchIfEmpty(defaultResource));
|
||||
* .andThen(resource -> resource.or(() -> defaultResource));
|
||||
* RouterFunction<ServerResponse> resources = RouterFunctions.resources(lookupFunction);
|
||||
* </pre>
|
||||
* @param pattern the pattern to match
|
||||
@@ -168,11 +168,6 @@ public abstract class RouterFunctions {
|
||||
return new ResourcesRouterFunction(lookupFunction);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static <T extends ServerResponse> HandlerFunction<T> cast(HandlerFunction<?> handlerFunction) {
|
||||
return (HandlerFunction<T>) handlerFunction;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Represents a discoverable builder for router functions.
|
||||
|
||||
@@ -76,7 +76,7 @@ public interface ServerResponse {
|
||||
* @param request the current request
|
||||
* @param response the response to write to
|
||||
* @param context the context to use when writing
|
||||
* @return {@code Mono<Void>} to indicate when writing is complete
|
||||
* @return a ModelAndView to render, or {@code null} if handled directly
|
||||
*/
|
||||
@Nullable
|
||||
ModelAndView writeTo(HttpServletRequest request, HttpServletResponse response, Context context)
|
||||
|
||||
Reference in New Issue
Block a user