Checks if the path for this instance is valid. @return true if the path given/calculated for this instance is valid, otherwise false
()
| 204 | * @return {@code true} if the path given/calculated for this instance is valid, otherwise {@code false} |
| 205 | */ |
| 206 | public boolean isPathValid() { |
| 207 | // No need to test for null since path can never be null (see constructors) |
| 208 | // |
| 209 | // Therefore, just need to check: |
| 210 | // - empty or start with / |
| 211 | // - normalized and no attempt to escape the root |
| 212 | // |
| 213 | // Note: Normalize check on empty path would fail |
| 214 | return path.isEmpty() || (path.startsWith("/") && path.equals(RequestUtil.normalize(path))); |
| 215 | } |
| 216 | |
| 217 | |
| 218 | /** |
no test coverage detected