jodd.http.HttpRequest.sendTo()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(101)

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

HttpRequest.sendTo介绍

暂无

代码示例

代码示例来源:origin: oblac/jodd

request.sendTo(out);

代码示例来源:origin: oblac/jodd

@Test
void testBigRequest() throws IOException {
  InputStream inputStream = ClassLoaderUtil.getResourceAsStream("/jodd/http/answer.json");
  FastCharArrayWriter writter = StreamUtil.copy(inputStream);
  String body = writter.toString();
  HttpRequest httpRequest = HttpRequest.get("").body(body);
  ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
  httpRequest.sendTo(outputStream);
  String receivedBody = outputStream.toString();
  int ndx = receivedBody.indexOf("{");
  receivedBody = receivedBody.substring(ndx);
  assertEquals(body, receivedBody);
}

代码示例来源:origin: oblac/jodd

private HttpResponse _send() {
  if (httpConnection == null) {
    open();
  }
  // sends data
  final HttpResponse httpResponse;
  try {
    OutputStream outputStream = httpConnection.getOutputStream();
    sendTo(outputStream);
    InputStream inputStream = httpConnection.getInputStream();
    httpResponse = HttpResponse.readFrom(inputStream);
    httpResponse.assignHttpRequest(this);
  } catch (IOException ioex) {
    throw new HttpException(ioex);
  }
  boolean keepAlive = httpResponse.isConnectionPersistent();
  if (!keepAlive) {
    // closes connection if keep alive is false, or if counter reached 0
    httpConnection.close();
    httpConnection = null;
  }
  return httpResponse;
}

代码示例来源:origin: org.jodd/jodd-http

request.sendTo(out);

代码示例来源:origin: org.jodd/jodd-http

private HttpResponse _send() {
  if (httpConnection == null) {
    open();
  }
  // sends data
  final HttpResponse httpResponse;
  try {
    OutputStream outputStream = httpConnection.getOutputStream();
    sendTo(outputStream);
    InputStream inputStream = httpConnection.getInputStream();
    httpResponse = HttpResponse.readFrom(inputStream);
    httpResponse.assignHttpRequest(this);
  } catch (IOException ioex) {
    throw new HttpException(ioex);
  }
  boolean keepAlive = httpResponse.isConnectionPersistent();
  if (!keepAlive) {
    // closes connection if keep alive is false, or if counter reached 0
    httpConnection.close();
    httpConnection = null;
  }
  return httpResponse;
}

相关文章