Exemplo n.º 1
0
 private void createConnection() throws IOException
 {
   String completeUrl = getCompleteUrl();
   if (connection == null)
   {
     System.setProperty("http.keepAlive", connectionKeepAlive ? "true" : "false");
     connection = (HttpURLConnection) new URL(completeUrl).openConnection();
     connection.setInstanceFollowRedirects(followRedirects);
   }
 }
Exemplo n.º 2
0
  private void createConnection() throws IOException {
    String effectiveUrl = URLUtils.appendParametersToQueryString(url, querystringParams);
    if (connection == null) {
      System.setProperty("http.keepAlive", connectionKeepAlive ? "true" : "false");
      // connection = (HttpURLConnection) new URL(effectiveUrl).openConnection();

      URL url = new URL(effectiveUrl);
      if (url.getProtocol().toLowerCase().equals("https")) {
        trustAllHosts();
        HttpsURLConnection https = (HttpsURLConnection) url.openConnection();
        https.setHostnameVerifier(DO_NOT_VERIFY);
        connection = https;
      } else {
        connection = (HttpURLConnection) url.openConnection();
      }
    }
  }