src/main/java/com/rockagen/commons/http/HttpConn.java
private static Object[] resolveUrl(String str) {

        String scheme = "http", host = "localhost", uri = "/";
        int port = 80;

        Object[] obj = new Object[2];

        try {
            if (str.length() >= 10) {
                String temp = str.substring(0, str.indexOf(":"));
                if (!CommUtil.isBlank(temp)) {
                    if (temp.equalsIgnoreCase("HTTP")
                            || temp.equalsIgnoreCase("HTTPS")) {
                        scheme = temp;
                        String temp1 = str.substring(temp.length() + 3);
                        if (temp1.indexOf("/") > 0) {
                            String temp2 = temp1.substring(0,
                                    temp1.indexOf("/"));
                            if (temp2.indexOf(":") > 0) {
                                String[] temp3 = temp2.split(":");
                                if (temp3.length > 1
                                        && temp3[1].matches("[0-9]*")) {
                                    port = Integer.parseInt(temp3[1]);
                                    host = temp3[0];
                                }

                            } else {
                                host = temp2;
                                if (temp.equalsIgnoreCase("HTTP")) {
                                    port = 80;
                                } else if (temp.equalsIgnoreCase("HTTPS")) {
                                    port = 443;
                                }
                            }
                            uri = temp1.substring(temp2.length());
                        } else {

                            if (temp1.indexOf(":") > 0) {
                                String[] temp3 = temp1.split(":");
                                if (temp3[1].matches("[0-9]*")) {
                                    port = Integer.parseInt(temp3[1]);
                                    host = temp3[0];

                                }

                            } else {
                                host = temp1;
                                if (temp.equalsIgnoreCase("HTTP")) {
                                    port = 80;
                                } else if (temp.equalsIgnoreCase("HTTPS")) {
                                    port = 443;
                                }
                            }
                            uri = "/";
                        }
                    }

                }

            }
        } catch (Exception e) {
            log.error("{}", e.getMessage(), e);
        }

        HttpHost targetHost = new HttpHost(host, port, scheme);
        obj[0] = targetHost;
        obj[1] = uri;
        log.debug("The parsed Object Array {}", Arrays.toString(obj));
        return obj;
    }
private static Object[] resolveUrl(String str) {

        String scheme = "http", host = "localhost", uri = "/";
        int port = 80;

        Object[] obj = new Object[2];

        try {
            if (str.length() >= 10) {
                String temp = str.substring(0, str.indexOf(":"));
                if (!CommUtil.isBlank(temp)) {
                    if (temp.equalsIgnoreCase("HTTP")
                            || temp.equalsIgnoreCase("HTTPS")) {
                        scheme = temp;
                        String temp1 = str.substring(temp.length() + 3);
                        if (temp1.indexOf("/") > 0) {
                            String temp2 = temp1.substring(0,
                                    temp1.indexOf("/"));
                            if (temp2.indexOf(":") > 0) {
                                String[] temp3 = temp2.split(":");
                                if (temp3.length > 1
                                        && temp3[1].matches("[0-9]*")) {
                                    port = Integer.parseInt(temp3[1]);
                                    host = temp3[0];
                                }

                            } else {
                                host = temp2;
                                if (temp.equalsIgnoreCase("HTTP")) {
                                    port = 80;
                                } else if (temp.equalsIgnoreCase("HTTPS")) {
                                    port = 443;
                                }
                            }
                            uri = temp1.substring(temp2.length());
                        } else {

                            if (temp1.indexOf(":") > 0) {
                                String[] temp3 = temp1.split(":");
                                if (temp3[1].matches("[0-9]*")) {
                                    port = Integer.parseInt(temp3[1]);
                                    host = temp3[0];

                                }

                            } else {
                                host = temp1;
                                if (temp.equalsIgnoreCase("HTTP")) {
                                    port = 80;
                                } else if (temp.equalsIgnoreCase("HTTPS")) {
                                    port = 443;
                                }
                            }
                            uri = "/";
                        }
                    }

                }

            }
        } catch (Exception e) {
            log.error("{}", e.getMessage(), e);
        }

        HttpHost targetHost = new HttpHost(host, port, scheme);
        obj[0] = targetHost;
        obj[1] = uri;
        log.debug("The parsed Object Array {}", Arrays.toString(obj));
        return obj;
    }
<p>
Resolve String to Object Array
</p>
<p>
Array length is 2,by default return http://localhost:80/
</p>
<li>[0]--> HttpHost</li> <li>[1]--> URI</li>

@param str the http url
@return object array [0]= HttpHost [1]=String(uri)