Initialize the scheme for this URI from a URI string spec.

@param p_uriSpec the URI specification (cannot be null)

@throws MalformedURIException if URI does not have a conformant
scheme
552433
private void initializeScheme(String p_uriSpec) throws MalformedURIException
  {

    int uriSpecLen = p_uriSpec.length();
    int index = 0;
    String scheme = null;
    char testChar = '\0';

    while (index < uriSpecLen)
    {
      testChar = p_uriSpec.charAt(index);

      if (testChar == ':' || testChar == '/' || testChar == '?'
              || testChar == '#')
      {
        break;
      }

      index++;
    }

    scheme = p_uriSpec.substring(0, index);

    if (scheme.length() == 0)
    {
      throw new MalformedURIException(Utils.messages.createMessage(MsgKey.ER_NO_SCHEME_INURI, null)); //"No scheme found in URI.");
    }
    else
    {
      setScheme(scheme);
    }
  }
9673
@Override
	protected void setInitURI(String uriString) throws CadiException {
		try {
			initURI = new URI(uriString);
		} catch (URISyntaxException e) {
			throw new CadiException(e);
		}
	}
395136
public static URI buildUri(String httpOrHttps, String host, String path,
            Map<String, String> paramMap) {
        try {
            return new URIBuilder().setScheme(httpOrHttps).setHost(host)
                    .setPath(path)
                    .setParameters(buildNameValuePareList(paramMap)).build();
        } catch (URISyntaxException e) {
            throw JMExceptionManager.handleExceptionAndReturnRuntimeEx(log, e,
                    "getResponseAsString", httpOrHttps, host, path, paramMap);
        }
    }
409161
public void setSecure(boolean isSecure) throws URIException {
        mIsSecure = isSecure;

        if (mUri == null) {
            // mUri not yet set
            return;
        }

        URI newUri = mUri;

        // check if URI consistent
        if (isSecure() && mUri.getScheme().equalsIgnoreCase(HTTP)) {
            newUri = new URI(mUri.toString().replaceFirst(HTTP, HTTPS), true);
            
        } else if (!isSecure() && mUri.getScheme().equalsIgnoreCase(HTTPS)) {
            newUri = new URI(mUri.toString().replaceFirst(HTTPS, HTTP), true);
        }

        if (newUri != mUri) {
            mUri = newUri;
            setHostPort(mUri.getPort());
        }
    }
528663
private URI _getSpecURI(String spec) {
        URI specURI = URI.create(spec);

        if (_scheme.indexOf(':') == -1) {
            return specURI;
        }
        
        String schemeSpecificPart = specURI.getSchemeSpecificPart();
        return URI.create(schemeSpecificPart);
    }
399417
protected URI buildUri(final String path, final List<NameValuePair> queryStringParams) {
        final StringBuilder sb = new StringBuilder();
        
        sb.append(path);
        if (queryStringParams != null && queryStringParams.size() > 0) {
            sb.append("?").append(URLEncodedUtils.format(queryStringParams, "UTF-8"));
        }

        try {
            return new URI(sb.toString());
        } catch (final URISyntaxException e) {
            throw new IllegalStateException("Invalid uri", e);
        }
    }
364458
public void init(boolean isSecure,
                   CharSequence host, int port,
                   byte []uri, int uriLength)
  {
    _isSecure = isSecure;
    
    _host = host;
    _port = port;
    
    _uri = uri;
    _uriLength = uriLength;
  }
133919
public static void setDefaultUri(Configuration conf, URI uri) {
    conf.set(FS_DEFAULT_NAME_KEY, uri.toString());
  }
76946
private static URL makeURLFromFilespec(final String filespec) throws IOException {
        String decoded = URLDecoder.decode(filespec, "UTF-8");
        File file = new File(decoded);
        // make sure it is canonical (no ../ and such)
        file = file.getCanonicalFile();

        return file.toURI().toURL();
    }
507334
private URL buildUriWithParameters(URL url, Map<String, String> params) throws URISyntaxException, MalformedURLException {
        if (params == null || params.isEmpty()) {
            return url;
        }
        URIBuilder uriBuilder = new URIBuilder(url.toURI());
        for (String paramName : params.keySet()) {
            uriBuilder.addParameter(paramName, params.get(paramName));
        }
        return uriBuilder.build().toURL();
    }
601099
public void setDefaultUri(String defaultUri) {

        if (m_frozen) {
            throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONFIG_FROZEN_0));
        }
        m_defaultUri = defaultUri;
    }
493211
public UriComponentsBuilder uriComponents(UriComponents uriComponents) {
		Assert.notNull(uriComponents, "'uriComponents' must not be null");
		this.scheme = uriComponents.getScheme();
		if (uriComponents instanceof OpaqueUriComponents) {
			this.ssp = uriComponents.getSchemeSpecificPart();
			resetHierarchicalComponents();
		}
		else {
			if (uriComponents.getUserInfo() != null) {
				this.userInfo = uriComponents.getUserInfo();
			}
			if (uriComponents.getHost() != null) {
				this.host = uriComponents.getHost();
			}
			if (uriComponents.getPort() != -1) {
				this.port = String.valueOf(uriComponents.getPort());
			}
			if (StringUtils.hasLength(uriComponents.getPath())) {
				List<String> segments = uriComponents.getPathSegments();
				if (segments.isEmpty()) {
					// Perhaps "/"
					this.pathBuilder.addPath(uriComponents.getPath());
				}
				else {
					this.pathBuilder.addPathSegments(segments.toArray(new String[segments.size()]));
				}
			}
			if (!uriComponents.getQueryParams().isEmpty()) {
				this.queryParams.clear();
				this.queryParams.putAll(uriComponents.getQueryParams());
			}
			resetSchemeSpecificPart();
		}
		if (uriComponents.getFragment() != null) {
			this.fragment = uriComponents.getFragment();
		}
		return this;
	}
31994
public static void checkUriScheme(String scheme) {
    String uri = String.format("%s://null", scheme);
    try {
      new URI(uri);
    } catch (URISyntaxException e) {
      throw new IllegalArgumentException(e);
    }
  }
544198
public void setURI(URI uri) throws URIException {

        if (uri.getScheme() == null || uri.getScheme().equals("")) {
            mUri = new URI(HTTP + "://" + getHeader(HOST) + "/" + mUri.toString(), true);
            
        } else {
            mUri = uri;
        }

        if (uri.getScheme().equalsIgnoreCase(HTTPS)) {
            mIsSecure = true;
            
        } else {
            mIsSecure = false;
        }

        setHostPort(mUri.getPort());
    }
795875
@Override
  public void _LocalPeer_setURI(String uri) throws MBeanException {
    // validate uri
    try {
      new URI(uri);

      getMutableConfiguration().setStringValue(OwnDiameterURI.ordinal(), uri);

      if (logger.isInfoEnabled()) {
        logger.info("Local Peer URI successfully changed to '" + uri + "'. Restart to Diameter stack is needed to apply changes.");
      }
    }
    catch (URISyntaxException use) {
      throw new MBeanException(use);
    }
  }
760880
private void initCipher(int mode) throws InvalidKeyException, InvalidAlgorithmParameterException
    {
        if (key != null)
        {
            if (params != null)
            {
                if (random != null)
                {
                    cipher.init(mode, key, params, random);
                }
                else
                {
                    cipher.init(mode, key, params);
                }
            }
            else if (spec != null)
            {
                if (random != null)
                {
                    cipher.init(mode, key, spec, random);
                }
                else
                {
                    cipher.init(mode, key, spec);
                }
            }
            else
            {
                if (random != null)
                {
                    cipher.init(mode, key, random);
                }
                else
                {
                    cipher.init(mode, key);
                }
            }
        }
        else
        {
            if (random != null)
            {
                cipher.init(mode, certificate, random);
            }
            else
            {
                cipher.init(mode, certificate);
            }
        }
    }
226852
@JsonIgnore
  @Override
  public void setUri(URI uri) throws URISyntaxException, NoSuchAlgorithmException, KeyManagementException
  {
    super.setUri(uri);
  }