Polishing
This commit is contained in:
@@ -537,6 +537,24 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
|
||||
return resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the given resource path.
|
||||
* <p>The default implementation replaces:
|
||||
* <ul>
|
||||
* <li>Backslash with forward slash.
|
||||
* <li>Duplicate occurrences of slash with a single slash.
|
||||
* <li>Any combination of leading slash and control characters (00-1F and 7F)
|
||||
* with a single "/" or "". For example {@code " / // foo/bar"}
|
||||
* becomes {@code "/foo/bar"}.
|
||||
* </ul>
|
||||
* @since 3.2.12
|
||||
*/
|
||||
protected String processPath(String path) {
|
||||
path = StringUtils.replace(path, "\\", "/");
|
||||
path = cleanDuplicateSlashes(path);
|
||||
return cleanLeadingSlash(path);
|
||||
}
|
||||
|
||||
private String cleanDuplicateSlashes(String path) {
|
||||
StringBuilder sb = null;
|
||||
char prev = 0;
|
||||
@@ -619,6 +637,7 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
|
||||
* path starts predictably with a single '/' or does not have one.
|
||||
* @param path the path to validate
|
||||
* @return {@code true} if the path is invalid, {@code false} otherwise
|
||||
* @since 3.0.6
|
||||
*/
|
||||
protected boolean isInvalidPath(String path) {
|
||||
if (path.contains("WEB-INF") || path.contains("META-INF")) {
|
||||
@@ -642,24 +661,6 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the given resource path.
|
||||
* <p>The default implementation replaces:
|
||||
* <ul>
|
||||
* <li>Backslash with forward slash.
|
||||
* <li>Duplicate occurrences of slash with a single slash.
|
||||
* <li>Any combination of leading slash and control characters (00-1F and 7F)
|
||||
* with a single "/" or "". For example {@code " / // foo/bar"}
|
||||
* becomes {@code "/foo/bar"}.
|
||||
* </ul>
|
||||
* @since 3.2.12
|
||||
*/
|
||||
protected String processPath(String path) {
|
||||
path = StringUtils.replace(path, "\\", "/");
|
||||
path = cleanDuplicateSlashes(path);
|
||||
return cleanLeadingSlash(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the media type for the given request and the resource matched
|
||||
* to it. This implementation tries to determine the MediaType based on the
|
||||
|
||||
Reference in New Issue
Block a user