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

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

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

HttpsURLConnection.setDoOutput介绍

暂无

代码示例

代码示例来源:origin: jmdhappy/xxpay-master

conn.setSSLSocketFactory(ssf);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);

代码示例来源:origin: jmdhappy/xxpay-master

conn.setSSLSocketFactory(ssf);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);

代码示例来源:origin: jmdhappy/xxpay-master

con.setRequestMethod("POST");
con.setDoInput(true);
con.setDoOutput(true);
con.setUseCaches(false);
con.setConnectTimeout(30 * 1000);

代码示例来源:origin: wuyouzhuguli/FEBS-Shiro

conn.setRequestProperty(ACCEPT_CHARSET, UTF8);
conn.setRequestProperty(CONTENTTYPE, UTF8);
conn.setDoOutput(true);
conn.setDoInput(true);

代码示例来源:origin: Javen205/IJPay

conn.setReadTimeout(25000);
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setDoInput(true);

代码示例来源:origin: Javen205/IJPay

conn.setReadTimeout(25000);
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setDoInput(true);

代码示例来源:origin: GlowstoneMC/Glowstone

URL url = new URL(UUID_URL);
conn = (HttpsURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");

代码示例来源:origin: jmdhappy/xxpay-master

con.setRequestMethod("POST");
con.setDoInput(true);
con.setDoOutput(true);
con.setUseCaches(false);
con.setConnectTimeout(10 * 1000);

代码示例来源:origin: jmdhappy/xxpay-master

con.setRequestMethod("POST");
con.setDoInput(true);
con.setDoOutput(true);
con.setUseCaches(false);
con.setConnectTimeout(10 * 1000);

代码示例来源:origin: apache/nifi

@Override
  public void run() {
    try {
      final int port = ((HandleHttpRequest) runner.getProcessor()).getPort();
      final HttpsURLConnection connection = (HttpsURLConnection) new URL("https://localhost:"
          + port + "/my/path?query=true&value1=value1&value2=&value3&value4=apple=orange").openConnection();
      connection.setSSLSocketFactory(sslContext.getSocketFactory());
      connection.setDoOutput(false);
      connection.setRequestMethod("GET");
      connection.setRequestProperty("header1", "value1");
      connection.setRequestProperty("header2", "");
      connection.setRequestProperty("header3", "apple=orange");
      connection.setConnectTimeout(3000);
      connection.setReadTimeout(3000);
      StreamUtils.copy(connection.getInputStream(), new NullOutputStream());
    } catch (final Throwable t) {
      t.printStackTrace();
      Assert.fail(t.toString());
    }
  }
});

代码示例来源:origin: jberkel/sms-backup-plus

private HttpsURLConnection postTokenEndpoint(String payload) throws IOException {
  HttpsURLConnection connection = (HttpsURLConnection) new URL(TOKEN_URL).openConnection();
  connection.setDoOutput(true);
  connection.setRequestMethod("POST");
  connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
  final OutputStream os = connection.getOutputStream();
  BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
  writer.write(payload);
  writer.flush();
  writer.close();
  os.close();
  return connection;
}

代码示例来源:origin: Talend/components

public RequestResult executeGetRequest(Class<?> resultClass) throws MarketoException {
  try {
    URL url = new URL(current_uri.toString());
    HttpsURLConnection urlConn = (HttpsURLConnection) url.openConnection();
    urlConn.setRequestMethod(QUERY_METHOD_GET);
    urlConn.setDoOutput(true);
    urlConn.setRequestProperty(REQUEST_PROPERTY_ACCEPT, REQUEST_VALUE_TEXT_JSON);
    return (RequestResult) new Gson().fromJson(getReaderFromHttpResponse(urlConn), resultClass);
  } catch (IOException e) {
    LOG.error("GET request failed: {}", e.getMessage());
    throw new MarketoException(REST, e.getMessage());
  }
}

代码示例来源:origin: org.talend.components/components-marketo-runtime

public RequestResult executeGetRequest(Class<?> resultClass) throws MarketoException {
  try {
    URL url = new URL(current_uri.toString());
    HttpsURLConnection urlConn = (HttpsURLConnection) url.openConnection();
    urlConn.setRequestMethod(QUERY_METHOD_GET);
    urlConn.setDoOutput(true);
    urlConn.setRequestProperty(REQUEST_PROPERTY_ACCEPT, REQUEST_VALUE_TEXT_JSON);
    return (RequestResult) new Gson().fromJson(getReaderFromHttpResponse(urlConn), resultClass);
  } catch (IOException e) {
    LOG.error("GET request failed: {}", e.getMessage());
    throw new MarketoException(REST, e.getMessage());
  }
}

代码示例来源:origin: org.talend.components/components-marketo-runtime

public MarketoRecordResult executeGetRequest(Schema schema) throws MarketoException {
  try {
    URL url = new URL(current_uri.toString());
    HttpsURLConnection urlConn = (HttpsURLConnection) url.openConnection();
    urlConn.setRequestMethod("GET");
    urlConn.setDoOutput(true);
    urlConn.setRequestProperty(REQUEST_PROPERTY_ACCEPT, REQUEST_VALUE_TEXT_JSON);
    return fillMarketoRecordResultFromReader(getReaderFromHttpResponse(urlConn), schema);
  } catch (IOException e) {
    LOG.error("Request failed: {}.", e.getMessage());
    throw new MarketoException(REST, e.getMessage());
  }
}

代码示例来源:origin: mockito/shipkit

private String doRequest(String relativeUrl, String method, Optional<String> body) throws IOException {
  URL url = new URL(gitHubApiUrl + relativeUrl);
  HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
  conn.setRequestMethod(method);
  conn.setDoOutput(true);
  conn.setRequestProperty("Content-Type", "application/json");
  conn.setRequestProperty("Authorization", "token " + authToken);
  if (body.isPresent()) {
    try (DataOutputStream wr = new DataOutputStream(conn.getOutputStream())) {
      wr.writeBytes(body.get());
      wr.flush();
    }
  }
  return call(method, conn);
}

代码示例来源:origin: Talend/components

public MarketoRecordResult executeGetRequest(Schema schema) throws MarketoException {
  try {
    URL url = new URL(current_uri.toString());
    HttpsURLConnection urlConn = (HttpsURLConnection) url.openConnection();
    urlConn.setRequestMethod("GET");
    urlConn.setDoOutput(true);
    urlConn.setRequestProperty(REQUEST_PROPERTY_ACCEPT, REQUEST_VALUE_TEXT_JSON);
    return fillMarketoRecordResultFromReader(getReaderFromHttpResponse(urlConn), schema);
  } catch (IOException e) {
    LOG.error("Request failed: {}.", e.getMessage());
    throw new MarketoException(REST, e.getMessage());
  }
}

代码示例来源:origin: microg/AppleWifiNlpBackend

private static void prepareConnection(HttpsURLConnection connection,
    int length) throws ProtocolException {
  connection.setRequestMethod("POST");
  connection.setDoInput(true);
  connection.setDoOutput(true);
  connection.setUseCaches(false);
  connection.setRequestProperty(HTTP_FIELD_CONTENT_TYPE, CONTENT_TYPE_URLENCODED);
  connection.setRequestProperty(HTTP_FIELD_CONTENT_LENGTH, String.valueOf(length));
}

代码示例来源:origin: io.takari/jdkget

public static JdkReleases readFromGithub() throws IOException {
 HttpsURLConnection conn = (HttpsURLConnection) new URL(REMOTE_XML).openConnection();
 conn.setAllowUserInteraction(false);
 conn.setDoInput(true);
 conn.setDoOutput(false);
 conn.setUseCaches(true);
 conn.setRequestMethod("GET");
 conn.setConnectTimeout(TIMEOUT_VALUE);
 conn.setReadTimeout(TIMEOUT_VALUE);
 conn.connect();
 return read(conn.getInputStream());
}

代码示例来源:origin: apache/jackrabbit-oak

protected static HttpsURLConnection getHttpsConnection(long length, URI uri) throws IOException {
    HttpsURLConnection conn = (HttpsURLConnection) uri.toURL().openConnection();
    conn.setDoOutput(true);
    conn.setRequestMethod("PUT");
    conn.setRequestProperty("Content-Length", String.valueOf(length));
    conn.setRequestProperty("Date", DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssX").withZone(ZoneOffset.UTC).format(Instant.now()));
    conn.setRequestProperty("Host", uri.getHost());

    return conn;
  }
}

代码示例来源:origin: apache/jackrabbit-oak

protected static HttpsURLConnection getHttpsConnection(long length, URI uri) throws IOException {
    HttpsURLConnection conn = (HttpsURLConnection) uri.toURL().openConnection();
    conn.setDoOutput(true);
    conn.setRequestMethod("PUT");
    conn.setRequestProperty("Content-Length", String.valueOf(length));
    conn.setRequestProperty("Date", DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssX")
      .withZone(ZoneOffset.UTC)
      .format(Instant.now()));
    conn.setRequestProperty("x-ms-version", "2017-11-09");

    return conn;
  }
}

相关文章

HttpsURLConnection类方法