Example usage for org.springframework.web.reactive.function.server PathResourceLookupFunction PathResourceLookupFunction

List of usage examples for org.springframework.web.reactive.function.server PathResourceLookupFunction PathResourceLookupFunction

Introduction

In this page you can find the example usage for org.springframework.web.reactive.function.server PathResourceLookupFunction PathResourceLookupFunction.

Prototype

public PathResourceLookupFunction(String pattern, Resource location) 

Source Link

Usage

From source file:org.springframework.web.reactive.function.server.RouterFunctions.java

/**
 * Route requests that match the given pattern to resources relative to the given root location.
 * For instance/*from  ww  w. j a  v  a 2s.  c o m*/
 * <pre class="code">
 * Resource location = new FileSystemResource("public-resources/");
 * RoutingFunction&lt;ServerResponse&gt; resources = RouterFunctions.resources("/resources/**", location);
  * </pre>
 * @param pattern the pattern to match
 * @param location the location directory relative to which resources should be resolved
 * @return a router function that routes to resources
 */
public static RouterFunction<ServerResponse> resources(String pattern, Resource location) {
    Assert.hasLength(pattern, "'pattern' must not be empty");
    Assert.notNull(location, "'location' must not be null");
    return resources(new PathResourceLookupFunction(pattern, location));
}