Generates a site matcher equivalent to this one but with a different scheme.<p>

@param scheme the new scheme
@return the new site matcher
498823
public CmsSiteMatcher forDifferentScheme(String scheme) {

        try {
            URI uri = new URI(getUrl());
            URI changedUri = new URI(scheme, uri.getAuthority(), uri.getPath(), uri.getQuery(), uri.getFragment());
            CmsSiteMatcher res = new CmsSiteMatcher(changedUri.toString(), m_timeOffset);
            res.setRedirect(m_redirect);
            return res;
        } catch (Exception e) {
            LOG.error(e.getLocalizedMessage(), e);
            return null;
        }
    }
316886
public static <T extends AnnotationDescription> ElementMatcher.Junction<T> annotationType(ElementMatcher<? super TypeDescription> matcher) {
        return new AnnotationTypeMatcher<T>(matcher);
    }
523099
public function matchesScheme($scheme)
    {
        $scheme = strtolower($scheme);
        $secure = $this->_data['secure'];
        return ($secure && $scheme === 'https') || (!$secure && $scheme === 'http');
    }
751682
public Matcher matcher(CharSequence s) {
        Matcher m = new Matcher(this);
        m.setTarget(s);
        return m;
    }
133701
public static Matcher<TreeNode> context(final Matcher<ContextElement> matcher) {
    return new Matcher<TreeNode>() {

      @Override
      protected boolean matchesSafely(TreeNode t) {
        return matcher.matches(t.getContext());
      }

      @Override
      public String toString() {
        return "a context that has " + matcher;
      }
    };
  }
1063062
@Override
  public PathImpl schemeWalk(String userPath,
                         Map<String,Object> newAttributes,
                         String uri,
                         int offset)
  {
    int length = uri.length();

    if (length < 2 + offset
        || uri.charAt(offset) != '/'
        || uri.charAt(1 + offset) != '/')
      throw new RuntimeException("bad scheme");

    CharBuffer buf = new CharBuffer();
    int i = 2 + offset;
    int ch = 0;
    boolean isIpv6 = false;
    
    for (; 
          (i < length
           && (ch = uri.charAt(i)) != '/'
           && ch != '?'
           && ! (ch == ':' && ! isIpv6));
         i++) {
      if (ch == '[')
        isIpv6 = true;
      else if (ch == ']')
        isIpv6 = false;
      
      buf.append((char) ch);
    }

    String host = buf.toString();
    if (host.length() == 0)
      throw new RuntimeException("bad host");

    int port = 0;
    if (ch == ':') {
      for (i++; i < length && (ch = uri.charAt(i)) >= '0' && ch <= '9'; i++) {
        port = 10 * port + uri.charAt(i) - '0';
      }
    }

    return create(this, userPath, newAttributes, host, port);
  }
1038043
@Override
	public boolean apply(final URI uri) {
		if (uri.getScheme() == null) throw new IllegalArgumentException("URI \"" + uri + "\" has no scheme");
		return scheme.equals(uri.getScheme());
	}
398846
public boolean matches(String schemeParam, String hostParam, String uriParam) {
        // If URI mapping enforce a host, ensure it is the one used.
        if (this.host != null && !this.host.equalsIgnoreCase(schemeParam + "://" + hostParam)) {
            return false;
        }

        if (this.extension != null && !uriParam.endsWith(this.extension)) {
            return false;
        }

        if (this.path != null && !uriParam.startsWith(this.path)) {
            return false;
        }
        return true;
    }
693385
public static PatternMatcher compile(String pattern) {
    String p = pattern;
    boolean ignoreCase = false;
    if (p.startsWith("(?i)")) {
      ignoreCase = true;
      p = pattern.substring(4);
    }
    if (p.length() > 0) {
      p = "^.*(" + p + ").*$";
    }
    Parser parser = new Parser(PatternUtils.expandEscapedChars(p));
    Matcher m = Optimizer.optimize(parser.parse());
    return ignoreCase ? m.ignoreCase() : m;
  }
762572
public NextInputs add(Input input, Scheme... schemes) {
        if (schemes == null || schemes.length == 0) {
            throw new IllegalArgumentException("Test schemes is required !");
        }
        Arrays.sort(schemes, ORDERING);
        mInputSpecs.add(new InputSpec(input, schemes));
        return this;
    }
478431
public static <T extends ParameterDescription> ElementMatcher.Junction<T> definedParameter(ElementMatcher<? super ParameterDescription.InDefinedShape> matcher) {
        return new DefinedShapeMatcher<T, ParameterDescription.InDefinedShape>(matcher);
    }
410764
public CmsSite matchRequest(HttpServletRequest req) {

        CmsSiteMatcher matcher = getRequestMatcher(req);
        if (matcher.getTimeOffset() != 0) {
            HttpSession session = req.getSession();
            if (session != null) {
                session.setAttribute(
                    CmsContextInfo.ATTRIBUTE_REQUEST_TIME,
                    new Long(System.currentTimeMillis() + matcher.getTimeOffset()));
            }
        }
        CmsSite site = matchSite(matcher);

        if (LOG.isDebugEnabled()) {
            String requestServer = req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort();
            LOG.debug(
                Messages.get().getBundle().key(
                    Messages.LOG_MATCHING_REQUEST_TO_SITE_2,
                    requestServer,
                    site.toString()));
        }
        return site;
    }
1295321
public Matcher getMatcher(String str) {
                Matcher m;
                if (matchers.containsKey(str)) {
                        m = matchers.get(str);
                } else {
                        m = p.matcher(str);
                        matchers.put(str, m);
                }
                return m;
        }
447377
SamlPortConfigBuilder setSchemeIfAbsent(SessionProtocol scheme) {
        requireNonNull(scheme, "scheme");
        if (this.scheme == null) {
            if (scheme == SessionProtocol.HTTPS ||
                scheme == SessionProtocol.HTTP) {
                this.scheme = scheme;
            } else {
                throw new IllegalArgumentException("unexpected session protocol: " + scheme);
            }
        }
        return this;
    }
91111
@Override
    public void setScheme(byte[] scheme) throws UnsupportedSchemeException {
        SchemeValues val = SchemeValues.find(scheme, 0, scheme.length);
        if (null == val) {
            throw new UnsupportedSchemeException("Illegal scheme " + GenericUtils.getEnglishString(scheme));
        }
        setScheme(val);
    }
698466
static protected function buildPatternFromScheme(URLScheme $scheme)
    {
		// generate a unique random string
		$uniq = md5(mt_rand());

		// replace the wildcard sub-domain if exists
		$scheme = str_replace(
			'://'.self::WILDCARD_CHARACTER.'.',
			'://'.$uniq,
			$scheme->__tostring()
		);

		// replace the wildcards
		$scheme = str_replace(
			self::WILDCARD_CHARACTER,
			$uniq,
			$scheme
		);

		// set the pattern wrap
		$wrap = '|';

		// quote the pattern
		$pattern = preg_quote($scheme, $wrap);

		// replace the unique string by the character class
		$pattern = str_replace($uniq, '.*', $pattern);

		return $wrap.$pattern.$wrap.'iu';
    }
604827
private static boolean isValidScheme(final String scheme) {
        final int length = scheme.length();
        if (length < 1) {
            return false;
        }
        char c = scheme.charAt(0);
        if (!Character.isLetter(c)) {
            return false;
        }
        for (int i = 1; i < length; i++) {
            c = scheme.charAt(i);
            if (!Character.isLetterOrDigit(c) && (c != '.') && (c != '+') && (c != '-')) {
                return false;
            }
        }
        return true;
    }