|
|
@ -33,8 +33,8 @@ import org.springframework.util.Assert;
|
|
|
|
import org.springframework.web.server.ServerWebExchange;
|
|
|
|
import org.springframework.web.server.ServerWebExchange;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Used to create a {@link ServerWebExchangeMatcher} for static resources in
|
|
|
|
* Used to create a {@link ServerWebExchangeMatcher} for static resources in commonly used
|
|
|
|
* commonly used locations. Returned by {@link PathRequest#toStaticResources()}.
|
|
|
|
* locations. Returned by {@link PathRequest#toStaticResources()}.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @author Madhura Bhave
|
|
|
|
* @author Madhura Bhave
|
|
|
|
* @since 2.0.0
|
|
|
|
* @since 2.0.0
|
|
|
@ -42,7 +42,7 @@ import org.springframework.web.server.ServerWebExchange;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public final class StaticResourceRequest {
|
|
|
|
public final class StaticResourceRequest {
|
|
|
|
|
|
|
|
|
|
|
|
private static final StaticResourceRequest INSTANCE = new StaticResourceRequest();
|
|
|
|
static final StaticResourceRequest INSTANCE = new StaticResourceRequest();
|
|
|
|
|
|
|
|
|
|
|
|
private StaticResourceRequest() {
|
|
|
|
private StaticResourceRequest() {
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -83,20 +83,11 @@ public final class StaticResourceRequest {
|
|
|
|
* @param locations the locations to include
|
|
|
|
* @param locations the locations to include
|
|
|
|
* @return the configured {@link ServerWebExchangeMatcher}
|
|
|
|
* @return the configured {@link ServerWebExchangeMatcher}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public StaticResourceServerWebExchange at(
|
|
|
|
public StaticResourceServerWebExchange at(Set<StaticResourceLocation> locations) {
|
|
|
|
Set<StaticResourceLocation> locations) {
|
|
|
|
|
|
|
|
Assert.notNull(locations, "Locations must not be null");
|
|
|
|
Assert.notNull(locations, "Locations must not be null");
|
|
|
|
return new StaticResourceServerWebExchange(new LinkedHashSet<>(locations));
|
|
|
|
return new StaticResourceServerWebExchange(new LinkedHashSet<>(locations));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Return the static resource request.
|
|
|
|
|
|
|
|
* @return the static resource request
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static StaticResourceRequest get() {
|
|
|
|
|
|
|
|
return INSTANCE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* The server web exchange matcher used to match against resource
|
|
|
|
* The server web exchange matcher used to match against resource
|
|
|
|
* {@link StaticResourceLocation Locations}.
|
|
|
|
* {@link StaticResourceLocation Locations}.
|
|
|
|