Code example for URI

Methods: getHost, getPort, getScheme

0
        } 
    } 
 
    private HttpHost GetHost(URI uri) {
        HttpHost host;
        int port = uri.getPort();
        if (port == -1) {
            port = uri.getScheme().equalsIgnoreCase("https") ? 443 : 80;
        } 
 
        host = new HttpHost(uri.getHost(), port, uri.getScheme());
        return host;
    } 
 
    protected synchronized String postContentToUrl(String url, String content) throws ApiException {
        if (sUserAgent == null) {
            throw new ApiException("User-Agent string must be prepared"); 
        } 
 
        // Create client and set our specific user-agent string 
        HttpClient client = CreateClient();