Remove a context from an existing host. @param ctxt The actual context @param hostName Virtual host name this context belongs to @param path Context path @param version Context version
(Context ctxt, String hostName, String path, String version)
| 333 | * @param version Context version |
| 334 | */ |
| 335 | public void removeContextVersion(Context ctxt, String hostName, String path, String version) { |
| 336 | |
| 337 | hostName = renameWildcardHost(hostName); |
| 338 | contextObjectToContextVersionMap.remove(ctxt); |
| 339 | |
| 340 | MappedHost host = exactFind(hosts, hostName); |
| 341 | if (host == null || host.isAlias()) { |
| 342 | return; |
| 343 | } |
| 344 | |
| 345 | synchronized (host) { |
| 346 | ContextList contextList = host.contextList; |
| 347 | MappedContext context = exactFind(contextList.contexts, path); |
| 348 | if (context == null) { |
| 349 | return; |
| 350 | } |
| 351 | |
| 352 | ContextVersion[] contextVersions = context.versions; |
| 353 | ContextVersion[] newContextVersions = new ContextVersion[contextVersions.length - 1]; |
| 354 | if (removeMap(contextVersions, newContextVersions, version)) { |
| 355 | if (newContextVersions.length == 0) { |
| 356 | // Remove the context |
| 357 | ContextList newContextList = contextList.removeContext(path); |
| 358 | if (newContextList != null) { |
| 359 | updateContextList(host, newContextList); |
| 360 | } |
| 361 | } else { |
| 362 | context.versions = newContextVersions; |
| 363 | } |
| 364 | } |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | |
| 369 | /** |