code: public IGlobalScope lookupGlobal(String hostName, String contextPath) {
          log.trace("{}", this);
          log.debug("Lookup global scope - host name: {} context path: {}", hostName, contextPath);
          // Init mappings key
          String key = getKey(hostName, contextPath);
          // If context path contains slashes get complex key and look for it in mappings
          while (contextPath.indexOf(SLASH) != -1) {
              key = getKey(hostName, contextPath);
              log.trace("Check: {}", key);
              String globalName = mapping.get(key);
              if (globalName != null) {
                  return getGlobal(globalName);
              }
              final int slashIndex = contextPath.lastIndexOf(SLASH);
              // Context path is substring from the beginning and till last slash index
              contextPath = contextPath.substring(0, slashIndex);
          }
          // Get global scope key
          key = getKey(hostName, contextPath);
          log.trace("Check host and path: {}", key);
          // Look up for global scope switching keys if still not found
          String globalName = mapping.get(key);
          if (globalName != null) {
              return getGlobal(globalName);
          }
          key = getKey(EMPTY, contextPath);
          log.trace("Check wildcard host with path: {}", key);
          globalName = mapping.get(key);
          if (globalName != null) {
              return getGlobal(globalName);
          }
          key = getKey(hostName, EMPTY);
          log.trace("Check host with no path: {}", key);
          globalName = mapping.get(key);
          if (globalName != null) {
              return getGlobal(globalName);
          }
          key = getKey(EMPTY, EMPTY);
          log.trace("Check default host, default path: {}", key);
          return getGlobal(mapping.get(key));
      }
docs: Does global scope lookup for host name and context path
  
  @param hostName
  Host name
  @param contextPath
  Context path
  @return Global scope