Example usage for org.springframework.web.util UriUtils extractFileExtension

List of usage examples for org.springframework.web.util UriUtils extractFileExtension

Introduction

In this page you can find the example usage for org.springframework.web.util UriUtils extractFileExtension.

Prototype

@Nullable
public static String extractFileExtension(String path) 

Source Link

Document

Extract the file extension from the given URI path.

Usage

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

/**
 * Return a {@code RequestPredicate} that matches if the request's path matches the given
 * predicate.//w w  w  . j  a  v a 2 s  .co m
 * @param extensionPredicate the predicate to test against the request path extension
 * @return a predicate that matches if the given predicate matches against the request's path
 * file extension
 */
public static RequestPredicate pathExtension(Predicate<String> extensionPredicate) {
    Assert.notNull(extensionPredicate, "'extensionPredicate' must not be null");
    return request -> {
        String pathExtension = UriUtils.extractFileExtension(request.path());
        return extensionPredicate.test(pathExtension);
    };
}