code: public int identifySite (HttpServletRequest req)
      {
          checkReloadSites();
          String serverName = req.getServerName();
  
          // scan for the mapping that matches the specified domain
          int msize = _mappings.size();
          for (int i = 0; i < msize; i++) {
              SiteMapping mapping = _mappings.get(i);
              if (serverName.endsWith(mapping.domain)) {
                  return mapping.siteId;
              }
          }
  
          // if we matched nothing, return the default id
          return _defaultSiteId;
      }
docs: documentation inherited