src/main/java/com/rockagen/commons/http/HttpConn.java
public static String send(UsernamePasswordCredentials upc,
                              InputStream keystore, char[] password, String target,
                              String proxy, String encoding, Map<String, String> headers, RequestMethod method)
            throws IOException {

        // TargetHost
        Object[] tmp = resolveUrl(target);
        HttpHost targetHost = (HttpHost) tmp[0];
        // URI
        String uri = (String) tmp[1];

        // ProxyHost
        HttpHost proxyHost = null;
        if (!CommUtil.isBlank(proxy)) {
            Object[] tmp1 = resolveUrl(proxy);
            proxyHost = (HttpHost) tmp1[0];
        }

        Header[] _headers = null;
        if (headers != null && headers.size() > 0) {
            _headers = new Header[headers.size()];
            for (Map.Entry<String, String> header : headers.entrySet()) {
                Header h = new BasicHeader(header.getKey(), header.getValue());
                ArrayUtil.add(_headers, h);
            }
        }

        return send(upc, keystore, password, targetHost, uri,
                proxyHost, encoding, method, _headers);
    }
public static String send(UsernamePasswordCredentials upc,
                              InputStream keystore, char[] password, String target,
                              String proxy, String encoding, Map<String, String> headers, RequestMethod method)
            throws IOException {

        // TargetHost
        Object[] tmp = resolveUrl(target);
        HttpHost targetHost = (HttpHost) tmp[0];
        // URI
        String uri = (String) tmp[1];

        // ProxyHost
        HttpHost proxyHost = null;
        if (!CommUtil.isBlank(proxy)) {
            Object[] tmp1 = resolveUrl(proxy);
            proxyHost = (HttpHost) tmp1[0];
        }

        Header[] _headers = null;
        if (headers != null && headers.size() > 0) {
            _headers = new Header[headers.size()];
            for (Map.Entry<String, String> header : headers.entrySet()) {
                Header h = new BasicHeader(header.getKey(), header.getValue());
                ArrayUtil.add(_headers, h);
            }
        }

        return send(upc, keystore, password, targetHost, uri,
                proxyHost, encoding, method, _headers);
    }
public static String send ( UsernamePasswordCredentials upc , InputStream keystore , char [ ] password , String target , String proxy , String encoding , Map < String , String > headers , RequestMethod method ) throws IOException { // TargetHost Object [ ] tmp = resolveUrl ( target ) ; HttpHost targetHost = ( HttpHost ) tmp [ 0 ] ; // URI String uri = ( String ) tmp [ 1 ] ; // ProxyHost HttpHost proxyHost = null ; if ( ! CommUtil . isBlank ( proxy ) ) { Object [ ] tmp1 = resolveUrl ( proxy ) ; proxyHost = ( HttpHost ) tmp1 [ 0 ] ; } Header [ ] _headers = null ; if ( headers != null && headers . size ( ) > 0 ) { _headers = new Header [ headers . size ( ) ] ; for ( Map . Entry < String , String > header : headers . entrySet ( ) ) { Header h = new BasicHeader ( header . getKey ( ) , header . getValue ( ) ) ; ArrayUtil . add ( _headers , h ) ; } } return send ( upc , keystore , password , targetHost , uri , proxyHost , encoding , method , _headers ) ; }
Send a http request with explicit params

@param upc      basic auth {@link UsernamePasswordCredentials}
@param keystore keyStore InputStream (Custom SSL)
@param password keyStore password
@param target   target address
@param proxy    proxy address
@param encoding (default UTF-8)
@param headers headers
@param method   {@link com.rockagen.commons.http.RequestMethod}
@return result String
@throws IOException  if an I/O error occurs
Send a http request with explicit params