java.net.HttpURLConnection.getDoOutput()方法的使用及代码示例

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

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

HttpURLConnection.getDoOutput介绍

暂无

代码示例

代码示例来源:origin: square/okhttp

@Override public boolean getDoOutput() {
 return delegate.getDoOutput();
}

代码示例来源:origin: prestodb/presto

@Override public boolean getDoOutput() {
 return delegate.getDoOutput();
}

代码示例来源:origin: spring-projects/spring-framework

@Override
protected ClientHttpResponse executeInternal(HttpHeaders headers, byte[] bufferedOutput) throws IOException {
  addHeaders(this.connection, headers);
  // JDK <1.8 doesn't support getOutputStream with HTTP DELETE
  if (getMethod() == HttpMethod.DELETE && bufferedOutput.length == 0) {
    this.connection.setDoOutput(false);
  }
  if (this.connection.getDoOutput() && this.outputStreaming) {
    this.connection.setFixedLengthStreamingMode(bufferedOutput.length);
  }
  this.connection.connect();
  if (this.connection.getDoOutput()) {
    FileCopyUtils.copy(bufferedOutput, this.connection.getOutputStream());
  }
  else {
    // Immediately trigger the request in a no-output scenario as well
    this.connection.getResponseCode();
  }
  return new SimpleClientHttpResponse(this.connection);
}

代码示例来源:origin: spring-projects/spring-framework

@Override
  public ClientHttpResponse call() throws Exception {
    SimpleBufferingClientHttpRequest.addHeaders(connection, headers);
    // JDK <1.8 doesn't support getOutputStream with HTTP DELETE
    if (getMethod() == HttpMethod.DELETE && bufferedOutput.length == 0) {
      connection.setDoOutput(false);
    }
    if (connection.getDoOutput() && outputStreaming) {
      connection.setFixedLengthStreamingMode(bufferedOutput.length);
    }
    connection.connect();
    if (connection.getDoOutput()) {
      FileCopyUtils.copy(bufferedOutput, connection.getOutputStream());
    }
    else {
      // Immediately trigger the request in a no-output scenario as well
      connection.getResponseCode();
    }
    return new SimpleClientHttpResponse(connection);
  }
});

代码示例来源:origin: org.springframework/spring-web

@Override
  public ClientHttpResponse call() throws Exception {
    SimpleBufferingClientHttpRequest.addHeaders(connection, headers);
    // JDK <1.8 doesn't support getOutputStream with HTTP DELETE
    if (getMethod() == HttpMethod.DELETE && bufferedOutput.length == 0) {
      connection.setDoOutput(false);
    }
    if (connection.getDoOutput() && outputStreaming) {
      connection.setFixedLengthStreamingMode(bufferedOutput.length);
    }
    connection.connect();
    if (connection.getDoOutput()) {
      FileCopyUtils.copy(bufferedOutput, connection.getOutputStream());
    }
    else {
      // Immediately trigger the request in a no-output scenario as well
      connection.getResponseCode();
    }
    return new SimpleClientHttpResponse(connection);
  }
});

代码示例来源:origin: org.springframework/spring-web

@Override
protected ClientHttpResponse executeInternal(HttpHeaders headers, byte[] bufferedOutput) throws IOException {
  addHeaders(this.connection, headers);
  // JDK <1.8 doesn't support getOutputStream with HTTP DELETE
  if (getMethod() == HttpMethod.DELETE && bufferedOutput.length == 0) {
    this.connection.setDoOutput(false);
  }
  if (this.connection.getDoOutput() && this.outputStreaming) {
    this.connection.setFixedLengthStreamingMode(bufferedOutput.length);
  }
  this.connection.connect();
  if (this.connection.getDoOutput()) {
    FileCopyUtils.copy(bufferedOutput, this.connection.getOutputStream());
  }
  else {
    // Immediately trigger the request in a no-output scenario as well
    this.connection.getResponseCode();
  }
  return new SimpleClientHttpResponse(this.connection);
}

代码示例来源:origin: spring-projects/spring-framework

private void testRequestBodyAllowed(URL uri, String httpMethod, boolean allowed) throws IOException {
  HttpURLConnection connection = new TestHttpURLConnection(uri);
  ((SimpleClientHttpRequestFactory) this.factory).prepareConnection(connection, httpMethod);
  assertEquals(allowed, connection.getDoOutput());
}

代码示例来源:origin: org.jsoup/jsoup

try {
  conn.connect();
  if (conn.getDoOutput())
    writePost(req, conn.getOutputStream(), mimeBoundary);

代码示例来源:origin: prestosql/presto

@Override public boolean getDoOutput() {
 return delegate.getDoOutput();
}

代码示例来源:origin: apache/servicemix-bundles

@Override public boolean getDoOutput() {
 return delegate.getDoOutput();
}

代码示例来源:origin: com.squareup.okhttp/okhttp-urlconnection

@Override public boolean getDoOutput() {
 return delegate.getDoOutput();
}

代码示例来源:origin: EvoSuite/evosuite

@Override
public boolean getDoOutput() {
  return super.getDoOutput();
}

代码示例来源:origin: org.codelibs/jcifs

@Override
public boolean getDoOutput () {
  return this.connection.getDoOutput();
}

代码示例来源:origin: apiman/apiman

@Override public boolean getDoOutput() {
 return delegate.getDoOutput();
}

代码示例来源:origin: AgNO3/jcifs-ng

@Override
public boolean getDoOutput () {
  return this.connection.getDoOutput();
}

代码示例来源:origin: com.squareup.okhttp3/okhttp-urlconnection

@Override public boolean getDoOutput() {
 return delegate.getDoOutput();
}

代码示例来源:origin: com.facebook.presto/presto-jdbc

@Override public boolean getDoOutput() {
 return delegate.getDoOutput();
}

代码示例来源:origin: io.apiman/apiman-gateway-platforms-servlet

@Override public boolean getDoOutput() {
 return delegate.getDoOutput();
}

代码示例来源:origin: com.github.ljun20160606/okhttp-urlconnection

@Override public boolean getDoOutput() {
 return delegate.getDoOutput();
}

代码示例来源:origin: com.dropbox.core/dropbox-core-sdk

@Override
public void close() {
  if (conn == null) return;
  // close input and output streams to allow for connection re-use.
  if (conn.getDoOutput()) {
    try {
      IOUtil.closeQuietly(conn.getOutputStream());
    } catch (IOException ex) {
      // ignore
    }
  }
  // should not need to disconnect after closing the relevant streams
  conn = null;
}

相关文章

HttpURLConnection类方法