标准URL定义方式

          标准URL定义方式

          //URI uriFindAllFastGroup = URIUtils.createURI("http", host, port, findAllFastGroupUrl, null, null);

            List<NameValuePair> qparamsPreload = new ArrayList<NameValuePair>();
            qparamsPreload.add(new BasicNameValuePair("appCode", appCodePreload));
            qparamsPreload.add(new BasicNameValuePair("enable","true"));
            URI uriPreload = URIUtils.createURI("http", host, port, serverIdUrl,URLEncodedUtils.format(qparamsPreload, "UTF-8"), null);


public class URIUtils {

     /**
         * Constructs a {@link URI} using all the parameters. This should be
         * used instead of
         * {@link URI#URI(String, String, String, int, String, String, String)}
         * or any of the other URI multi-argument URI constructors.
         *
         * @param scheme
         *            Scheme name
         * @param host
         *            Host name
         * @param port
         *            Port number
         * @param path
         *            Path
         * @param query
         *            Query
         * @param fragment
         *            Fragment
         *
         * @throws URISyntaxException
         *             If both a scheme and a path are given but the path is
         *             relative, if the URI string constructed from the given
         *             components violates RFC&nbsp;2396, or if the authority
         *             component of the string is present but cannot be parsed
         *             as a server-based authority
         */
    public static URI createURI(
            final String scheme,
            final String host,
            int port,
            final String path,
            final String query,
            final String fragment) throws URISyntaxException{...}

}



你可能感兴趣的:(标准URL定义方式)