Code example for URL

Methods: getDefaultPort, getHost, getPort, getProtocol

0
    } 
  } 
 
  public THttpClient(String url, HttpClient client) throws TTransportException {
    try { 
      url_ = new URL(url);
      this.client = client;
      this.host = new HttpHost(url_.getHost(), -1 == url_.getPort() ? url_.getDefaultPort() : url_.getPort(), url_.getProtocol());
    } catch (IOException iox) {
      throw new TTransportException(iox);
    } 
  } 
 
  public void setConnectTimeout(int timeout) {
    connectTimeout_ = timeout;
    if (null != this.client) {
      // WARNING, this modifies the HttpClient params, this might have an impact elsewhere if the 
      // same HttpClient is used for something else. 
      client.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, connectTimeout_);
    } 
  }