ResourceResolver that tries to find a resource under the given
locations matching to the request path.
This resolver does not delegate to the ResourceResolverChain and is
expected to be configured at the end in a chain of resolvers.
| Modifier and Type | Field and Description |
|---|---|
| private Resource[] |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | Returns: "true" if resource is in a valid location, "false" otherwisethe resource to check resource, Resource the location relative to which the resource was found location)Perform additional checks on a resolved resource beyond checking whether the resource exists and is readable. |
| public Resource[] | |
| private Mono | |
| protected Mono | Returns: the resource, or emptyMono if none foundthe path to the resource resourcePath, Resource the location to check location)Find the resource under the given location. |
| private boolean | |
| private boolean | |
| protected Mono | resolveResourceInternal(ServerWebExchange exchange, String requestPath, List<? extends Resource> locations, ResourceResolverChain chain)
Implements abstract org.
|
| protected Mono | resolveUrlPathInternal(String path, List<? extends Resource> locations, ResourceResolverChain chain)
Implements abstract org.
|
| public void | setAllowedLocations(Resource...
the list of allowed locations locations)By default, when a Resource is found, the path of the resolved resource is compared to ensure it's under the input location where it was found. |
| allowedLocations | back to summary |
|---|---|
| private Resource[] allowedLocations
| |
| PathResourceResolver | back to summary |
|---|---|
| public PathResourceResolver() | |
| checkResource | back to summary |
|---|---|
| protected boolean checkResource(Resource resource, Resource location) throws IOException Perform additional checks on a resolved resource beyond checking whether the
resource exists and is readable. The default implementation also verifies
the resource is either under the location relative to which it was found or
is under one of the | |
| getAllowedLocations | back to summary |
|---|---|
public Resource[] getAllowedLocations()
| |
| getResource | back to summary |
|---|---|
| private Mono | |
| getResource | back to summary |
|---|---|
| protected Mono Find the resource under the given location. The default implementation checks if there is a readable
| |
| isInvalidEncodedPath | back to summary |
|---|---|
| private boolean isInvalidEncodedPath(String resourcePath) | |
| isResourceUnderLocation | back to summary |
|---|---|
| private boolean isResourceUnderLocation(Resource resource, Resource location) throws IOException | |
| resolveResourceInternal | back to summary |
|---|---|
| protected Mono Implements abstract org.
| |
| resolveUrlPathInternal | back to summary |
|---|---|
| protected Mono Implements abstract org.
| |
| setAllowedLocations | back to summary |
|---|---|
| public void setAllowedLocations(Resource... locations) By default, when a Resource is found, the path of the resolved resource is
compared to ensure it's under the input location where it was found.
However sometimes that may not be the case, e.g. when
This property allows configuring a complete list of locations under which resources must be so that if a resource is not under the location relative to which it was found, this list may be checked as well. By default
| |