Standard SSL in HttpClient 的标准用法(转自apache)

来自apache的调用HttpClient的标准用法 (version 3.1)

HttpClient httpclient = new HttpClient();
  GetMethod httpget = new GetMethod("https://www.verisign.com/");
  try {
    httpclient.executeMethod(httpget);
    System.out.println(httpget.getStatusLine());
  } finally {
    httpget.releaseConnection();
  }

需要执行 httpclient.executeMethod(httpget);  否则后面用到httpget会报空指针异常。
其他的连接样例可参考官网:http://hc.apache.org/httpclient-3.x/sslguide.html

你可能感兴趣的:(httpclient)