| 2091 | |
| 2092 | |
| 2093 | @Override |
| 2094 | public void setPath(String path) { |
| 2095 | boolean invalid = false; |
| 2096 | if (path == null || path.equals("/")) { |
| 2097 | invalid = true; |
| 2098 | this.path = ""; |
| 2099 | } else if (path.isEmpty() || path.startsWith("/")) { |
| 2100 | this.path = path; |
| 2101 | } else { |
| 2102 | invalid = true; |
| 2103 | this.path = "/" + path; |
| 2104 | } |
| 2105 | if (this.path.endsWith("/")) { |
| 2106 | invalid = true; |
| 2107 | this.path = this.path.substring(0, this.path.length() - 1); |
| 2108 | } |
| 2109 | if (invalid) { |
| 2110 | log.warn(sm.getString("standardContext.pathInvalid", path, this.path)); |
| 2111 | } |
| 2112 | encodedPath = URLEncoder.DEFAULT.encode(this.path, StandardCharsets.UTF_8); |
| 2113 | if (getName() == null) { |
| 2114 | setName(this.path); |
| 2115 | } |
| 2116 | } |
| 2117 | |
| 2118 | |
| 2119 | @Override |