javax.net.ssl.HttpsURLConnection.getContent()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(178)

本文整理了Java中javax.net.ssl.HttpsURLConnection.getContent()方法的一些代码示例,展示了HttpsURLConnection.getContent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpsURLConnection.getContent()方法的具体详情如下:
包路径:javax.net.ssl.HttpsURLConnection
类名称:HttpsURLConnection
方法名:getContent

HttpsURLConnection.getContent介绍

暂无

代码示例

代码示例来源:origin: net.roboconf/roboconf-iaas-azure

private String processGetRequest(URL url, String keyStore, String keyStorePassword)
throws UnrecoverableKeyException, KeyManagementException, KeyStoreException, NoSuchAlgorithmException, IOException {
  SSLSocketFactory sslFactory = this.getSSLSocketFactory(keyStore, keyStorePassword);
  HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
  con.setSSLSocketFactory(sslFactory);
  con.setRequestMethod("GET");
  con.addRequestProperty("x-ms-version", "2014-04-01");
  InputStream responseStream = (InputStream) con.getContent();
  try {
    return getStringFromInputStream(responseStream);
  } finally {
    Utils.closeQuietly( responseStream );
  }
}

代码示例来源:origin: guardianproject/NetCipher

connection.setConnectTimeout(0); // blocking connect with TCP timeout
connection.setReadTimeout(20000);
connection.getContent();
assertEquals(200, connection.getResponseCode());
assertEquals("text/html", connection.getContentType().split(";")[0]);

代码示例来源:origin: guardianproject/NetCipher

SSLSocketFactory sslSocketFactory = connection.getSSLSocketFactory();
assertTrue(sslSocketFactory instanceof TlsOnlySocketFactory);
connection.getContent();
assertEquals(200, connection.getResponseCode());
assertEquals("text/html", connection.getContentType().split(";")[0]);

代码示例来源:origin: guardianproject/NetCipher

assertTrue(sslSocketFactory instanceof TlsOnlySocketFactory);
try {
  connection.getContent();
  System.out.println("This should not have connected, it has BAD SSL: " + host);
  fail();

代码示例来源:origin: guardianproject/NetCipher

SSLSocketFactory sslSocketFactory = connection.getSSLSocketFactory();
assertTrue(sslSocketFactory instanceof TlsOnlySocketFactory);
connection.getContent();
assertEquals(200, connection.getResponseCode());
assertEquals("text/html", connection.getContentType().split(";")[0]);

相关文章

HttpsURLConnection类方法