Top Description Fields Constructors Methods
org.springframework.web.servlet.function

pack-priv Class PathResourceLookupFunction

extends Object
implements Function<ServerRequest, Optional<Resource>>
Class Inheritance
All Implemented Interfaces
java.util.function.Function
Imports
java.io.IOException, .UncheckedIOException, java.nio.charset.StandardCharsets, java.util.Optional, java.util.function.Function, org.springframework.core.io.ClassPathResource, .Resource, .UrlResource, org.springframework.http.server.PathContainer, org.springframework.util.Assert, .ResourceUtils, .StringUtils, org.springframework.web.util.pattern.PathPattern, .PathPatternParser

Lookup function used by RouterFunctions#resources(String, Resource).
Author
Arjen Poutsma
Since
5.2

Field Summary

Modifier and TypeField and Description
private final Resource
private final PathPattern

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Optional<Resource>
apply(ServerRequest
the function argument
request
)

Implements java.util.function.Function.apply.

Applies this function to the given argument.

private boolean
private boolean
private String
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

locationback to summary
private final Resource location
patternback to summary
private final PathPattern pattern

Constructor Detail

PathResourceLookupFunctionback to summary
public PathResourceLookupFunction(String pattern, Resource location)

Method Detail

applyback to summary
public Optional<Resource> apply(ServerRequest request)

Implements java.util.function.Function.apply.

Doc from java.util.function.Function.apply.

Applies this function to the given argument.

Parameters
request:ServerRequest

the function argument

Returns:Optional<Resource>

the function result

Annotations
@Override
isInvalidPathback to summary
private boolean isInvalidPath(String path)
isResourceUnderLocationback to summary
private boolean isResourceUnderLocation(Resource resource) throws IOException
processPathback to summary
private String processPath(String path)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override